> ... but that rationale looks bogus to me. In particular, the thread > heading into cond_wait() must have already tested the condition under the > lock and concluded it was false in order to decide to cond_wait(). Since > any thread changing state that would affect the condition must also be > holding the lock, there is no way for the state (and thus the outcome of > the test) to change beween the test and the cond_wait(), and thus any > cond_signal() sent during that window would end up being spurious anyway.
You are correct. The notion that the mutex needs to be held across calls to cv_signal() or cv_broadcast() is simply false. It might have been true with very early implementations of the cv code for some reason, but it's certainly not true today. Jeff