
7 Dec
2006
7 Dec
'06
7:10 p.m.
Anthony Williams <anthony_w.geo <at> yahoo.com> writes:
[...]
c) if we release the mutex first, the state might have changed, and we might have additional threads waiting on the condition variables. Holding the mutex whilst we notify the CVs helps keep everything easy to follow.
[...]
Anthony
If the mutex is not locked, other thread can lock the mutex before the thread being awakened by the condition variable. This might delay scheduling of the thread waiting on the condition variable. -- regards, Prashant