From patchwork Mon Feb 28 09:10:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 594701 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1S9B9JU006857 for ; Mon, 28 Feb 2011 09:11:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752769Ab1B1JK5 (ORCPT ); Mon, 28 Feb 2011 04:10:57 -0500 Received: from mail-gx0-f174.google.com ([209.85.161.174]:36202 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752901Ab1B1JKy (ORCPT ); Mon, 28 Feb 2011 04:10:54 -0500 Received: by mail-gx0-f174.google.com with SMTP id 8so1438591gxk.19 for ; Mon, 28 Feb 2011 01:10:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=4RL6ww4LokCZg6iN0W/coaUECOIlh6nSthi3GxX5Saw=; b=t+2ez9Jw3Y+tAzEWASCPPPY0t5QU1AyFOAwO99B9XXemCSTWUsZDM0VRCiyB1FRX11 uPPs96pOfARtfUklRKTlz1Hb3CNprFiVKU0lbhLJvp97W/pO5qtYUq8K7Xe/CDTHj1C3 bYu8B9cq2qQYG8uhsy8t8DKpoN7pRT6sIgZbg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=gZd/u/MN5LY4NpKEU1P7IHfRDkyhG5WWNE05frwhANYzqdBhZ+Am2gvekcnCFdMkHk zAw5/5q7RJOwGF0mSCtfuYzTkzI1oYx1IcJvDkNiF/dQQdv/FeqUc/DF239PpGK/JUP6 jJ6Z1OjF468KrUDk2k4RIU42BKtMUjc3iMaw4= Received: by 10.150.49.17 with SMTP id w17mr6829445ybw.377.1298884254596; Mon, 28 Feb 2011 01:10:54 -0800 (PST) Received: from localhost.localdomain (93-34-149-100.ip50.fastwebnet.it [93.34.149.100]) by mx.google.com with ESMTPS id 1sm2037209yhl.11.2011.02.28.01.10.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Feb 2011 01:10:54 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, aurelien@aurel32.net, blauwirbel@gmail.com, jan.kiszka@siemes.com, mtosatti@redhat.com Subject: [PATCH v3 uq/master 07/22] add assertions on the owner of a QemuMutex Date: Mon, 28 Feb 2011 10:10:09 +0100 Message-Id: <1298884224-19734-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1298884224-19734-1-git-send-email-pbonzini@redhat.com> References: <1298884224-19734-1-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 28 Feb 2011 09:11:09 +0000 (UTC) diff --git a/qemu-thread-posix.c b/qemu-thread-posix.c index e307773..a4c6e25 100644 --- a/qemu-thread-posix.c +++ b/qemu-thread-posix.c @@ -28,8 +31,12 @@ static void error_exit(int err, const char *msg) void qemu_mutex_init(QemuMutex *mutex) { int err; + pthread_mutexattr_t mutexattr; - err = pthread_mutex_init(&mutex->lock, NULL); + pthread_mutexattr_init(&mutexattr); + pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK); + err = pthread_mutex_init(&mutex->lock, &mutexattr); + pthread_mutexattr_destroy(&mutexattr); if (err) error_exit(err, __func__); }