From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52670 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOvws-00087u-Rz for qemu-devel@nongnu.org; Wed, 16 Jun 2010 12:58:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOvwK-0001Mj-Cr for qemu-devel@nongnu.org; Wed, 16 Jun 2010 12:58:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14792) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOvwK-0001Mc-5t for qemu-devel@nongnu.org; Wed, 16 Jun 2010 12:58:12 -0400 Message-ID: <4C18FFB5.3050001@redhat.com> Date: Wed, 16 Jun 2010 18:45:41 +0200 From: Paolo Bonzini MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH V4 2/3] qemu: Generic task offloading framework: threadlets References: <20100616115404.10988.62371.stgit@localhost.localdomain> <20100616115656.10988.96529.stgit@localhost.localdomain> <4C18C4C8.8090901@redhat.com> <20100616142236.GA20052@shareable.org> <4C18DFD7.1090102@redhat.com> <4C18E1E8.3030606@linux.vnet.ibm.com> <20100616145858.GA19642@shareable.org> <20100616150714.GA24172@shareable.org> In-Reply-To: <20100616150714.GA24172@shareable.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jamie Lokier Cc: Gautham R Shenoy , Qemu-development List , Anthony Liguori , "Aneesh Kumar K.V" , Corentin Chary , Avi Kivity 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