Re: msleep : question and typo
Re: msleep : question and typo
- Subject: Re: msleep : question and typo
- From: Stéphane Sudre <email@hidden>
- Date: Thu, 31 Jul 2008 19:10:15 +0200
On Jul 31, 2008, at 6:40 PM, Terry Lambert wrote:
On Jul 31, 2008, at 8:39 AM, Rick Macklem <email@hidden>
wrote:
On Thu, 31 Jul 2008, Stéphane Sudre wrote:
Typo:
http://developer.apple.com/documentation/Darwin/Conceptual/KernelProgramming/services/chapter_16_section_2.html#/
/apple_ref/doc/uid/TP30000905-CH219-CHDFIGGH
"you should with either use wait_queue functions or use"
-> with--;
Question:
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.
Does it:
- wake up all the sleeping "threads" at once?
or
- wake up only one sleeping thread?
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.
Thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden