![]() |
Re: Timer programming, battery consumption
Quote:
|
Re: Timer programming, battery consumption
here's some quick code:
while (1) { f = fopen("/sys/devices...blahblah",...) fread() write to bluetooth(); ... usleep(500); } |
Re: Timer programming, battery consumption
Quote:
The above is for applets, but libiphb can be used directly. Shame most applet writers opt for g_timeout_add_seconds () first... Quote:
|
Re: Timer programming, battery consumption
Oh! libiphb! I've been trying to remember that name for half a year now! Thanks!
|
Re: Timer programming, battery consumption
sleep() is bad. Never use sleep() for anything except for quick debugging. If you need to do something that is periodic, either figure out how to poll for it, or use a system timer. That heartbeat mechanism is sexy.
Never, ever, ever use sleep. |
All times are GMT. The time now is 15:46. |
vBulletin® Version 3.8.8