On Feb 27, 2011, at 4:26 PM, Yuri <y...@rawbw.com> wrote:

> Forwarding to standards@ and davidxu@ per Garrett Cooper suggestion.
> 
> Also I want to add that I came to this question while observing behavior 
> consistent with multiple wakeup on FreeBSD-8.1. The heavily multi-threaded 
> code that assumes that only one thread can be woken up by one 
> pthread_cond_signal call crashes, and the only reasonable explanation so far 
> is that more than one threads are actually being woken up.

It depends on what you mean by wakeup.  More than one thread may unblock, but 
only one thread will have the mutex locked after wakeup.  If other threads 
awake (as allowed by POSIX), they will have to check the state protected by the 
mutex to see if they really should awake and continue  or if they should block 
again on the CV.  A wakeup from pthread_cond_wait() should not assume that he 
was the only thread awoken.

--
DE_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to