From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1a5o-0007WS-4n for qemu-devel@nongnu.org; Wed, 25 Nov 2015 08:26:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1a5j-00008T-4f for qemu-devel@nongnu.org; Wed, 25 Nov 2015 08:26:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1a5i-00008O-Va for qemu-devel@nongnu.org; Wed, 25 Nov 2015 08:26:35 -0500 References: <565485A0.5090902@sysgo.com> <5654883F.9050509@redhat.com> <56557AA2.9080100@sysgo.com> <5655AA1F.8060906@sysgo.com> From: Paolo Bonzini Message-ID: <5655B706.6060306@redhat.com> Date: Wed, 25 Nov 2015 14:26:30 +0100 MIME-Version: 1.0 In-Reply-To: <5655AA1F.8060906@sysgo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] qemu_mutex_iothread_locked not correctly synchronized List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Engraf , qemu-devel@nongnu.org Cc: Fam Zheng On 25/11/2015 13:31, David Engraf wrote: > Hi Paolo, > > please check the new version. I removed changing the iothread_locked > variable. But I still need to set the correct value of iothread_locked > when using qemu_cond_wait. No, you don't. Who is reading iothread_locked during qemu_cond_wait_iothread? No one, because it is a thread-local variable whose address is never taken. Paolo > +static void qemu_cond_wait_iothread(QemuCond *cond) > +{ > + iothread_locked = false; > + qemu_cond_wait(cond, &qemu_global_mutex); > + iothread_locked = true; > +}