On Thu, Mar 06, 2014 at 02:34:25PM -0500, Michael Conrad wrote: > I know this borders on bike-shedding, but if you really want to run > something exactly 60 times per elapsed minute you need to compare > calls to clock_gettime(CLOCK_MONOTONIC). Nothing else will work > reliably in all cases, and certainly not signals. (if the system is > lagged significantly, two signals can be merged into one)
POSIX timers with signal-based delivery can be used reliably for this purpose too. Realtime signals can be queued, and even if the queue overflows, the timer_getoverrun() function can tell you how many overruns there were (so you can compensate). In principle POSIX timers with thread-based delivery should also work for this purpose, but due to bugs in glibc, it's not 100% reliable and expirations may be lost. And if you don't mind using threads, it's easy to just roll your own approach with clock_gettime and clock_nanosleep with TIMER_ABSTIME, as you described. Rich _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox