|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-devel] Re: [PATCH V4 2/3] qemu: Generic task offloading framework: threadlets |
Date: | Wed, 16 Jun 2010 18:45:41 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b2pre Thunderbird/3.0.4 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |