From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34496 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6lUf-0004Rs-PR for qemu-devel@nongnu.org; Fri, 15 Oct 2010 10:42:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6lUV-0001Ii-OI for qemu-devel@nongnu.org; Fri, 15 Oct 2010 10:42:40 -0400 Received: from lo.gmane.org ([80.91.229.12]:49266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6lUV-0001Ic-Ix for qemu-devel@nongnu.org; Fri, 15 Oct 2010 10:42:39 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1P6lUS-0000Sq-4V for qemu-devel@nongnu.org; Fri, 15 Oct 2010 16:42:36 +0200 Received: from nat-pool-brq-t.redhat.com ([209.132.186.34]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 15 Oct 2010 16:42:36 +0200 Received: from pbonzini by nat-pool-brq-t.redhat.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 15 Oct 2010 16:42:36 +0200 From: Paolo Bonzini Date: Fri, 15 Oct 2010 16:42:27 +0200 Message-ID: <4CB86853.9060408@redhat.com> References: <20101013152921.21735.87339.stgit@localhost6.localdomain6> <20101013153110.21735.16669.stgit@localhost6.localdomain6> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit In-Reply-To: Subject: [Qemu-devel] Re: [PATCH 1/3] Introduce threadlets List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Arun R Bharadwaj On 10/14/2010 11:02 AM, Stefan Hajnoczi wrote: > 2. Moving qemu_cond_signal() outside queue->lock is dangerous for the > same reason: you need to be careful not to qemu_cond_signal() when the > thread isn't inside qemu_cond_timedwait()." Yes, please do so. I personally consider it bad programming practice to put the condvar signal/broadcast outside the mutex. While I understand that my ideas may not matter much, some Mr. Hoare actually invented them without signal-outside-lock, and he probably knows better than anyone reading. Paolo