+---------- On Feb 22, Andrew Piskorski said: > Why do I need to use a separate flag value in addition to the mutex? > In other words, why can't I just do something like:
If T1 starts T2, after locking $mutex, then T1 can just wait on $cond. But sometimes you have two or more independent threads and you can't rely on that. For example, nsd has one thread that receives connections and puts them on a queue, and several threads that pick off queued connections and serve them. For that, nsd has to use the full synchronization scenario I described.