![]() ![]() Not waking up thread, pass -wakeup to wake up thread If (kevent(kq, &kev, 1, NULL, 0, &timeout) = -1)įprintf(stderr, "not waking up thread, pass -wakeup to wake up thread\n") If (pthread_create(&thread, NULL, run_thread, NULL)) arbitrary number used for the identifier property Sources:Ĭompile with clang -o test -std=c99 test.c #include Note that if you use this to implement your own condition and timedwait, you do not need locks in order to avoid race conditions, contrary to this excellent answer, because you cannot "miss" an event on the queue. OSX 10.6 and FreeBSD 8.1 add support for EVFILT_USER, which we can use to wake up the event loop from another thread. Kqueue and kevent can be utilized for this purpose. Even without that bug, the clock would have jumped backwards one second. The Linux kernel leap second bug was a result of failing to do housekeeping after setting the clock back a second. See also: Leap Seconds and What To Do With Them. ![]() How the system resolves this discrepancy is implementation-defined, but it's common for the leap second to share the same UNIX timestamp as the previous second. POSIX days are exactly 86,400 seconds long, but real-world days can rarely be longer or shorter.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |