From: Rob McCool <robm@netscape.com> Newsgroups: netscape.devs-nsapi,netscape.devs-server-technical Subject: Re: Question about condition variable, critical section & Semaphore Date: Fri, 26 Jul 1996 20:02:22 -0700Satish Krishnaraj wrote: > 2) > conditions support provided by NSAPI set wakes up > all the threads waiting for that condition. > There are many situations where we would want only one waiting > thread to wake up on a notification of a condition. > Only broadcast semantics is provided by NSAPI.
If this is true, it is a serious problem. I was not aware that my documentation in the header file was misleading in this regard; the truth is that only one thread will be awakened, not "any threads".
I have seen the correct behavior happening in any of the server code which uses condvars. Do you have an example where all of them are awakened?
> 3) > multiple calls to sem_grab(..) of a semaphore already created > and initialized, does not block. (I am invoking sem_grab(...) > in the same thread.)
Yes, again this is an unfortunate result of the fact that the sem_* routines have a misleading name.
-- Rob McCool, robm@netscape.com http://home.netscape.com/people/robm/ Stunt Programmer, Netscape Communications Corporation It was working ten minutes ago, I swear...Reproduced by permission of the author.