The unlock-and-block part of cond_wait() is atomic; hence, by the time another thread acquires the lock, this first thread is guaranteed to be in a waiting state.
Spurious signals cannot cause a deadlock either — the test condition is lock-protected and can only proceed when other thread has entered cond_wait() (with the cond variable set to the satisfaction of the first thread).
In reply to Re^11: Threads sharing global variable
by Anonymous Monk
in thread Threads sharing global variable
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |