Re: msleep : question and typo
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Typo: http://developer.apple.com/documentation/Darwin/Conceptual/KernelProgramming... "you should with either use wait_queue functions or use" -> with--; Question: Does it: - wake up all the sleeping "threads" at once? or - wake up only one sleeping thread? -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... On Jul 31, 2008, at 8:39 AM, Rick Macklem <rmacklem@uoguelph.ca> wrote: On Thu, 31 Jul 2008, Stéphane Sudre wrote: Let's say you are in a re-entrant callback and you make a call to msleep(void * channel, ...) on multiple calls with the same channel and you then issue a wakeup(void * channel) call. Normally wakes up all threads sleeping on that event at the time of the wake up call. (A common practice is to put the msleep() in a loop checking for the condition it is sleeping for. ie. Using "while(..) msleep();" instead of "if(...) msleep();". This does result in threads waking up and then going back to sleep, so if you can use separate events easily, that could be more efficient.) Both wakeup ("wake all sleepers") and wakeup_one ("wakeup exactly one sleeper") are exported KPI. This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert