On 06/16/2010 05:07 PM, Jamie Lokier wrote:
Putting the whole condition inside the mutex->cond_wait region, not
just empty queue test, will remove the need for timed wait.

Yes, the condition must include all the cases when you broadcast.

Broadcast
is still needed, or alternatively a cond_signal from each exiting
thread will allow them to wake and close without a thundering herd.

If the pthreads cause a thundering herd, that's the pthreads problem. A properly implemented condvar will just requeue the threads to the mutex. NPTL does, the Win32 condvar most likely won't. :)

Anyway if Corentin doesn't need the flush_threadlets_queue all this can be dropped.

Paolo

Reply via email to