From nobody Mon Feb 9 03:13:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1586527017; cv=none; d=zohomail.com; s=zohoarc; b=NrvYajaWWn0Z9+KZsQt0p8CVYOV7jv4yNla49VhxOVdBoh8yEYOVobnxbGtj2tLA+47hC4szY5zFfxg3rTTkM6oSPxOzka+2GfvFOO7ae9fAFR+s0el4tEdKxbzDlwEBOYTBrdGZDZW8MqytU+uwRmsaLaGrFepr1WhVjNNcoxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527017; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qwrb93QA0vZdtIEclm0+u2y1xQDi9xDN/l0mH3dcKko=; b=bmOyW5EOoJeRc+nbyBdCiQq4ObdhYN+OVExvEWoLpT1Uq2MeGDLgnTWbqu8XWti91pFURD7Zo1fme1QAZRpMYtgEbSnv1SjIZ+htTCyOVk/3M8ID4r65EmpmBVG6K4TvVk4pfbMEvpiWJBXDhModyXgDCEV2n5Olgxmv9isft5E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586527017313608.0128757330341; Fri, 10 Apr 2020 06:56:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-153-hAK8TRQpMEa6r6tl2lyNNA-1; Fri, 10 Apr 2020 09:56:53 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D126BDB35; Fri, 10 Apr 2020 13:56:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A53AA94B40; Fri, 10 Apr 2020 13:56:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 656451819AD0; Fri, 10 Apr 2020 13:56:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuKqc023337 for ; Fri, 10 Apr 2020 09:56:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 584D110E60DD; Fri, 10 Apr 2020 13:56:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5453D10E60DC for ; Fri, 10 Apr 2020 13:56:20 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C3CD8FF663 for ; Fri, 10 Apr 2020 13:56:20 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-6-_JNcClDzPLKplatLXI6Veg-1; Fri, 10 Apr 2020 09:56:17 -0400 Received: by mail-wr1-f65.google.com with SMTP id h9so2371974wrc.8 for ; Fri, 10 Apr 2020 06:56:17 -0700 (PDT) Received: from localhost.localdomain (public-gprs377075.centertel.pl. [37.47.104.52]) by smtp.gmail.com with ESMTPSA id c11sm3066319wrt.24.2020.04.10.06.56.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527016; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=qwrb93QA0vZdtIEclm0+u2y1xQDi9xDN/l0mH3dcKko=; b=FDup1BNDTcXL1MElTGhi+18QP6GdLUPc2Gg6ti6G3OWni3hoQZ9JQEV2LC3ridLzAUusDG B24Rl4m2U9UYZAnFdu1rwaJAhovmvzcu5yuv9NOBewt5z0Fh7qiFSzaJjVB7bFfStUWev2 p8VvktiCZ8CsQSPostsJHss8Bljh0xc= X-MC-Unique: hAK8TRQpMEa6r6tl2lyNNA-1 X-MC-Unique: _JNcClDzPLKplatLXI6Veg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BlrV71V/38ATn7BBQ6/jcDyi4pIw+XfqPF+AFMoL2sY=; b=dJ9DXS8ROK3mQrsEOvPos7bKe2iOAiDKfrFG6gDmIcV3JMpb5e2SuxQRnh4ItdihhB intF45q8VYw+LakQvDqsbqOkhEWhiJm81jgDW7cUnfW2TFFYjGIGlprE/iXo4I+wESAm 1Rd7z2guevsXJP8r6V88uTgJjWWbllFaA0X0f2+/SdDW5WWzZgWC1plLUIqrcibzFoAN o1SqGwh6xQmrBQwOqFka0c6SEUO1tH+6C3CbPXjOZhrGihYZYB9Dnm+KPsnOY46eqliH HXV8VC4sjcrT7OYk3IKI86g83TmanNGtAnifI8Ki0mm/Wol7piSGurskqvILL8ACeT8v 5zWg== X-Gm-Message-State: AGi0PuYS/Qv75UGNZd4xWHOU3+GHbXlYffpqYzDyLIVZ6VeP53BuCjXY /Rnzo38JfjxUU1Jliq6dHziuQ9Bpbf8= X-Google-Smtp-Source: APiQypJiv5o98N5fQYdc8CNplyU58BtUGbNqTa1OCOziu6QWNAp7mhRvav4Yfu+9i2HpkOnawF2rbg== X-Received: by 2002:a5d:4746:: with SMTP id o6mr4741324wrs.304.1586526975447; Fri, 10 Apr 2020 06:56:15 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 37/43] tools: virsh: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:55:04 +0200 Message-Id: <20200410135510.2148319-38-r4f4rfs@gmail.com> In-Reply-To: <20200410135510.2148319-1-r4f4rfs@gmail.com> References: <20200410135510.2148319-1-r4f4rfs@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuKqc023337 X-loop: libvir-list@redhat.com Cc: Rafael Fonseca X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Rafael Fonseca --- tools/virsh.c | 11 ++++------- tools/virt-admin.c | 11 ++++------- tools/vsh.c | 4 ++-- tools/vsh.h | 2 +- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 197a90636d..f2da8ad340 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -414,11 +414,11 @@ virshDeinit(vshControl *ctl) if (ctl->eventLoopStarted) { int timer; =20 - virMutexLock(&ctl->lock); + g_mutex_lock(&ctl->lock); ctl->quit =3D true; /* HACK: Add a dummy timeout to break event loop */ timer =3D virEventAddTimeout(0, virshDeinitTimer, NULL, NULL); - virMutexUnlock(&ctl->lock); + g_mutex_unlock(&ctl->lock); =20 virThreadJoin(&ctl->eventLoop); =20 @@ -431,7 +431,7 @@ virshDeinit(vshControl *ctl) ctl->eventLoopStarted =3D false; } =20 - virMutexDestroy(&ctl->lock); + g_mutex_clear(&ctl->lock); =20 return true; } @@ -877,10 +877,7 @@ main(int argc, char **argv) #endif } =20 - if (virMutexInit(&ctl->lock) < 0) { - vshError(ctl, "%s", _("Failed to initialize mutex")); - return EXIT_FAILURE; - } + g_mutex_init(&ctl->lock); =20 if (virInitialize() < 0) { vshError(ctl, "%s", _("Failed to initialize libvirt")); diff --git a/tools/virt-admin.c b/tools/virt-admin.c index a8e5e0a5af..712bac07df 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1203,11 +1203,11 @@ vshAdmDeinit(vshControl *ctl) if (ctl->eventLoopStarted) { int timer; =20 - virMutexLock(&ctl->lock); + g_mutex_lock(&ctl->lock); ctl->quit =3D true; /* HACK: Add a dummy timeout to break event loop */ timer =3D virEventAddTimeout(0, vshAdmDeinitTimer, NULL, NULL); - virMutexUnlock(&ctl->lock); + g_mutex_unlock(&ctl->lock); =20 virThreadJoin(&ctl->eventLoop); =20 @@ -1217,7 +1217,7 @@ vshAdmDeinit(vshControl *ctl) ctl->eventLoopStarted =3D false; } =20 - virMutexDestroy(&ctl->lock); + g_mutex_clear(&ctl->lock); } =20 /* @@ -1563,10 +1563,7 @@ main(int argc, char **argv) #endif } =20 - if (virMutexInit(&ctl->lock) < 0) { - vshError(ctl, "%s", _("Failed to initialize mutex")); - return EXIT_FAILURE; - } + g_mutex_init(&ctl->lock); =20 if (virAdmInitialize() < 0) { vshError(ctl, "%s", _("Failed to initialize libvirt")); diff --git a/tools/vsh.c b/tools/vsh.c index 58bb1e6a3c..b803dd6aa5 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1989,9 +1989,9 @@ vshEventLoop(void *opaque) =20 while (1) { bool quit; - virMutexLock(&ctl->lock); + g_mutex_lock(&ctl->lock); quit =3D ctl->quit; - virMutexUnlock(&ctl->lock); + g_mutex_unlock(&ctl->lock); =20 if (quit) break; diff --git a/tools/vsh.h b/tools/vsh.h index 174116b369..49e1fef06e 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -208,7 +208,7 @@ struct _vshControl { char *historydir; /* readline history directory name */ char *historyfile; /* readline history file name */ virThread eventLoop; - virMutex lock; + GMutex lock; bool eventLoopStarted; bool quit; int eventPipe[2]; /* Write-to-self pipe to end waiting for an --=20 2.25.2