|
Rockbox mail archiveSubject: Where should this functionality go?Where should this functionality go?
From: c s <rb_dev_at_yahoo.com>
Date: Wed, 30 Apr 2003 15:43:06 -0700 (PDT) As I mentioned a while back, I wrote some code that implements a “car power adapter mode” that automatically stops playback when external power is turned off, such as when you turn off your car ignition switch. To do this I have to periodically monitor the status of external power and perform the appropriate processing when that state changes. That’s no problem. The question is, where should I do this periodic monitoring of the external power status? The power_management thread seems like the logical place, no? The only problem with that is that the periodic loop of the power_management thread has a cycle time of about a minute as it spends almost all of it’s time in 3 separate calls to sleep(), one for as long as 30 seconds, and I need to poll the external power status much more frequently. If want to poll the status of the external power from within the power_management thread, I can change the 3 calls to sleep() inside the main loop to instead be calls to a function that will sleep for the specified time AND poll the external power status a few times a second while doing this sleep for the main thread loop. Would this be an acceptable way of doing this? ===== Craig rb_dev_at_yahoo.com __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com Received on 2003-05-01 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |