From nobody Mon Feb 9 16:51:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1586527028; cv=none; d=zohomail.com; s=zohoarc; b=cavQqnh1Yaa2CZq4ZivawKYU7j2UchQQpyhlJqoNmOsdD1upTKPGq+W4LDVm97oGn+eHwXE08O6KViJBZAOZwAgVmai5AVuDhEs2DxejLlWttXoaW/5tdWa/7p175TaQTmc6yRj+PPxXoUJamzTemT6Rqpr4Bl4LLJHRI4mUsBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527028; 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=pGwxCYBIih4RwnZb0mfykv6zZ+9kklSv9E0sjNX0aIE=; b=m6bPOhDul9c9h6sB6x8PaDw/z0TkLXeF6tEunsWsS5FyVjmUo5hRe+/+n7Tb4P8mZEyjK2tamUXW0cwTJJpfIhEgbDAjn7pl3CYtOB8pksU+RJhzv3CPHnY1nqEkHYiLDI6WPI3wb6EppES8l8jdAMiMNvbQQRynI2GMk9E/vVs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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 [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586527028345656.5836287046487; Fri, 10 Apr 2020 06:57:08 -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-370-S_urH9KQM7WRzoPP2MJtpw-1; Fri, 10 Apr 2020 09:57:01 -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 19E9618B5F77; Fri, 10 Apr 2020 13:56:56 +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 E5E57CFDEA; Fri, 10 Apr 2020 13:56:55 +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 9EF6D1819AD4; Fri, 10 Apr 2020 13:56:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuSc8023434 for ; Fri, 10 Apr 2020 09:56:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 86BB5127513; Fri, 10 Apr 2020 13:56:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82B3F127512 for ; Fri, 10 Apr 2020 13:56:28 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 68D16800294 for ; Fri, 10 Apr 2020 13:56:28 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-_RKr5bGPPOKnwmn-aHe2JQ-1; Fri, 10 Apr 2020 09:56:25 -0400 Received: by mail-wm1-f67.google.com with SMTP id z6so2821467wml.2 for ; Fri, 10 Apr 2020 06:56:25 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527027; 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=pGwxCYBIih4RwnZb0mfykv6zZ+9kklSv9E0sjNX0aIE=; b=FxdOv/PYrpIvkv7tizNSWWjnfs8jNajT8bQojm1romoQICz2lOhgWIod6j9h8bUESjaJm6 u0LYgsnMkAQ09hesYewqhMocmkQ0AdQZm/qyCKK0SCJsPLPWM9x76QhN7k4uqmCljpe4+y ylv78NmCxq2ZpFqyQX2jWzrfIkQ3Ux8= X-MC-Unique: S_urH9KQM7WRzoPP2MJtpw-1 X-MC-Unique: _RKr5bGPPOKnwmn-aHe2JQ-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=3BuRWAd0/ftW54WQgiRWXklrFf6hnfW/ri9HkElV+pk=; b=UWKGRsH//9GhYOOy9rbZryf3mxPYMQEOtEtMCSrlS0onJLFNPJaPr6DOV7G90K6fbh raSuJ1HPNObZC0pbLXmCduicyxGqAZT33sGkftj7Nf9h+e/yto2Rdp8ewkEZivUcr/IO 27eBRNsPlsGUUtl/bU0gH377vA/3vl9dvT8rNV0L4bLVFl4FWy3UR/KYTrQBkrDWINvo SlCXGRDBxgOfm0hmnNJMfNs3Vu5VhSKXcx9LNo4qQnVtqdPXZbd+lAOEIg0+1KgAxihk 5QS3C5u89Brmr0oHNilWG+IwgWo29kv7qfBTURUQkGa26pn+ckHZNINsI4Pzj/+a8Jca WjxA== X-Gm-Message-State: AGi0PuaBDGXCXPoPju+LV0VKGCa3zD0N7Orf8yCtdZqgRlIXtiEEvZyh MwgjphZcdI4/Sc3d91cLwNluY1NE+vk= X-Google-Smtp-Source: APiQypLfnAwPubykRQg671LipTtR75Qf8m6Sw/R9PEG1mtuLDZ7fqs8msMkEpR2XHBmR3bE0LjoZ9g== X-Received: by 2002:a1c:f21a:: with SMTP id s26mr5394246wmc.187.1586526984227; Fri, 10 Apr 2020 06:56:24 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 43/43] util: virthread: remove GMutex and Gcond Date: Fri, 10 Apr 2020 15:55:10 +0200 Message-Id: <20200410135510.2148319-44-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.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuSc8023434 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" All instances where they were used have now been converted to the Glib equivalents. Signed-off-by: Rafael Fonseca --- examples/systemtap/lock-debug.stp | 4 +- src/libvirt_private.syms | 11 ---- src/util/virthread.c | 101 ------------------------------ src/util/virthread.h | 41 ------------ 4 files changed, 2 insertions(+), 155 deletions(-) diff --git a/examples/systemtap/lock-debug.stp b/examples/systemtap/lock-de= bug.stp index 0c9cc38692..dd8ee42b54 100644 --- a/examples/systemtap/lock-debug.stp +++ b/examples/systemtap/lock-debug.stp @@ -35,12 +35,12 @@ probe library =3D process( %( $# > 0 %? @1 %: "/usr/lib= /libvirt.so" %) ) if (filter()) next } =20 -probe lock =3D library.function("virMutexLock") +probe lock =3D library.function("g_mutex_lock") { lockname =3D usymdata($m) } =20 -probe unlock =3D library.function("virMutexUnlock") +probe unlock =3D library.function("g_mutex_unlock") { lockname =3D usymdata($m) } diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 4dfafdfd3e..054a1a5fce 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3259,17 +3259,6 @@ virSystemdTerminateMachine; =20 =20 # util/virthread.h -virCondBroadcast; -virCondDestroy; -virCondInit; -virCondSignal; -virCondWait; -virCondWaitUntil; -virMutexDestroy; -virMutexInit; -virMutexInitRecursive; -virMutexLock; -virMutexUnlock; virOnce; virThreadCancel; virThreadCreateFull; diff --git a/src/util/virthread.c b/src/util/virthread.c index 1ec5096ced..5300273f0e 100644 --- a/src/util/virthread.c +++ b/src/util/virthread.c @@ -43,107 +43,6 @@ int virOnce(virOnceControlPtr once, virOnceFunc init) } =20 =20 -int virMutexInit(virMutexPtr m) -{ - int ret; - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL); - ret =3D pthread_mutex_init(&m->lock, &attr); - pthread_mutexattr_destroy(&attr); - if (ret !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -int virMutexInitRecursive(virMutexPtr m) -{ - int ret; - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - ret =3D pthread_mutex_init(&m->lock, &attr); - pthread_mutexattr_destroy(&attr); - if (ret !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -void virMutexDestroy(virMutexPtr m) -{ - pthread_mutex_destroy(&m->lock); -} - -void virMutexLock(virMutexPtr m) -{ - pthread_mutex_lock(&m->lock); -} - -void virMutexUnlock(virMutexPtr m) -{ - pthread_mutex_unlock(&m->lock); -} - - -int virCondInit(virCondPtr c) -{ - int ret; - if ((ret =3D pthread_cond_init(&c->cond, NULL)) !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -int virCondDestroy(virCondPtr c) -{ - int ret; - if ((ret =3D pthread_cond_destroy(&c->cond)) !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -int virCondWait(virCondPtr c, virMutexPtr m) -{ - int ret; - if ((ret =3D pthread_cond_wait(&c->cond, &m->lock)) !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -int virCondWaitUntil(virCondPtr c, virMutexPtr m, unsigned long long whenm= s) -{ - int ret; - struct timespec ts; - - ts.tv_sec =3D whenms / 1000; - ts.tv_nsec =3D (whenms % 1000) * 1000000; - - if ((ret =3D pthread_cond_timedwait(&c->cond, &m->lock, &ts)) !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -void virCondSignal(virCondPtr c) -{ - pthread_cond_signal(&c->cond); -} - -void virCondBroadcast(virCondPtr c) -{ - pthread_cond_broadcast(&c->cond); -} - struct virThreadArgs { virThreadFunc func; char *name; diff --git a/src/util/virthread.h b/src/util/virthread.h index a57c99bdf0..d55407d693 100644 --- a/src/util/virthread.h +++ b/src/util/virthread.h @@ -26,20 +26,6 @@ =20 #include =20 -typedef struct virMutex virMutex; -typedef virMutex *virMutexPtr; - -struct virMutex { - pthread_mutex_t lock; -}; - -typedef struct virCond virCond; -typedef virCond *virCondPtr; - -struct virCond { - pthread_cond_t cond; -}; - typedef struct virThreadLocal virThreadLocal; typedef virThreadLocal *virThreadLocalPtr; =20 @@ -62,11 +48,6 @@ struct virOnceControl { }; =20 =20 -#define VIR_MUTEX_INITIALIZER \ - { \ - .lock =3D PTHREAD_MUTEX_INITIALIZER \ - } - #define VIR_ONCE_CONTROL_INITIALIZER \ { \ .once =3D PTHREAD_ONCE_INIT \ @@ -117,28 +98,6 @@ unsigned long long virThreadID(virThreadPtr thread); int virOnce(virOnceControlPtr once, virOnceFunc init) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; =20 -int virMutexInit(virMutexPtr m) G_GNUC_WARN_UNUSED_RESULT; -int virMutexInitRecursive(virMutexPtr m) G_GNUC_WARN_UNUSED_RESULT; -void virMutexDestroy(virMutexPtr m); - -void virMutexLock(virMutexPtr m); -void virMutexUnlock(virMutexPtr m); - - -int virCondInit(virCondPtr c) G_GNUC_WARN_UNUSED_RESULT; -int virCondDestroy(virCondPtr c); - -/* virCondWait, virCondWaitUntil: - * These functions can return without the associated predicate - * changing value. Therefore in nearly all cases they - * should be enclosed in a while loop that checks the predicate. - */ -int virCondWait(virCondPtr c, virMutexPtr m) G_GNUC_WARN_UNUSED_RESULT; -int virCondWaitUntil(virCondPtr c, virMutexPtr m, unsigned long long whenm= s) G_GNUC_WARN_UNUSED_RESULT; - -void virCondSignal(virCondPtr c); -void virCondBroadcast(virCondPtr c); - =20 typedef void (*virThreadLocalCleanup)(void *); int virThreadLocalInit(virThreadLocalPtr l, --=20 2.25.2