Re: msleep : question and typo
Re: msleep : question and typo
- Subject: Re: msleep : question and typo
- From: Rick Macklem <email@hidden>
- Date: Thu, 31 Jul 2008 11:39:29 -0400 (EDT)
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.)
Have fun with it, rick
ps: I remember spotting the same typo, so that doc is getting read;-)
_______________________________________________
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