From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuMye-0002Hz-IJ for qemu-devel@nongnu.org; Tue, 10 Jun 2014 10:24:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WuMyX-0008Rb-3Y for qemu-devel@nongnu.org; Tue, 10 Jun 2014 10:24:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuMyW-0008RT-RY for qemu-devel@nongnu.org; Tue, 10 Jun 2014 10:24:33 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5AEOVCH014793 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 10 Jun 2014 10:24:32 -0400 Message-ID: <5397151D.1050700@redhat.com> Date: Tue, 10 Jun 2014 16:24:29 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1401813551-6667-1-git-send-email-pbonzini@redhat.com> <1401813551-6667-6-git-send-email-pbonzini@redhat.com> <20140610101018.34c62092@redhat.com> In-Reply-To: <20140610101018.34c62092@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/6] monitor: protect outbuf with mutex List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, kraxel@redhat.com Il 10/06/2014 16:10, Luiz Capitulino ha scritto: >> > + qemu_mutex_lock(&hmp.out_lock); >> > if (qstring_get_length(hmp.outbuf) > 0) { >> > output = g_strdup(qstring_get_str(hmp.outbuf)); >> > } else { >> > output = g_strdup(""); >> > } >> > + qemu_mutex_unlock(&hmp.out_lock); > Are you sure we need to lock/unlock in this function? hmp is allocated > in the stack. > No, we don't but it was more obvious to me this way (and looking at it again, I'm pretty sure that some static analyzer would complain without these). Paolo