From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LjiPL-00069F-2R for qemu-devel@nongnu.org; Tue, 17 Mar 2009 19:09:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LjiPF-00068q-M4 for qemu-devel@nongnu.org; Tue, 17 Mar 2009 19:09:13 -0400 Received: from [199.232.76.173] (port=35757 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LjiPF-00068n-GE for qemu-devel@nongnu.org; Tue, 17 Mar 2009 19:09:09 -0400 Received: from mx20.gnu.org ([199.232.41.8]:13726) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LjiPF-0003us-3N for qemu-devel@nongnu.org; Tue, 17 Mar 2009 19:09:09 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LjiPD-0004gJ-Uo for qemu-devel@nongnu.org; Tue, 17 Mar 2009 19:09:08 -0400 From: Paul Brook Subject: Re: [Qemu-devel] [patch 1/2] qemu: sem/thread helpers Date: Tue, 17 Mar 2009 23:07:07 +0000 References: <20090311161645.344003675@localhost.localdomain> <49BD0D98.8050803@redhat.com> <20090317174217.GA10492@amt.cnet> In-Reply-To: <20090317174217.GA10492@amt.cnet> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903172307.08253.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Marcelo Tosatti On Tuesday 17 March 2009, Marcelo Tosatti wrote: > On Sun, Mar 15, 2009 at 04:15:52PM +0200, Avi Kivity wrote: > > Marcelo Tosatti wrote: > >> + > >> +struct QemuSem { > >> + sem_t sema; > >> +}; > > > > Why aren't you using pthread_mutex_t? > > Because we want the thread waiting on the lock to be awakened > once the holder releases it. This does not happen with pthread > mutexes AFAIK. Really? I'd be surprised if there's any difference. The whole point of a mutex is that it blocks until the other thread releases it. At best it sounds like you're making fairly sketchy assumptions about the host OS scheduler heuristics. Paul