Interval timer clock7/7/2023 ![]() on pthread_cond_timedwait) on such systems, and figure it might be lower-quality due to lack of monotonic clock, but that this is just a fundamental limitation of using a low-quality implementation like MacOSX.Īs for your concern about leap seconds, if ntpd or similar is making your realtime clock jump backwards when a leap second occurs, that's a serious bug in ntpd. Since you mentioned that some broken systems might lack these interfaces, you could simply have a drop-in implementation (based e.g. Short of that, I would just recommend making your own thread that uses clock_nanosleep with TIMER_ABSTIME and CLOCK_MONOTONIC for an interval timer. Unfortunately glibc's implementation actually creates a new thread for each expiration (which both has a lot of overhead and destroys any hope of realtime-quality robustness) despite the fact that the standard allows reuse of the same thread for each expiration. POSIX timers ( timer_create) do not require signals you can also arrange for the timer expiration to be delivered in a thread via the SIGEV_THREAD notification type. Not waking up thread, pass -wakeup to wake up thread If (kevent(kq,
0 Comments
Leave a Reply. |