From nobody Tue Sep 9 03:13:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1749111131; cv=none; d=zohomail.com; s=zohoarc; b=E8Sz+91RObJJkHPWRan2wS7vFJZbieRaKsRtsAcEZY/ooex7VOiC70x2HEV8BvgxUM3mFdUFqf4wzlzn7SRHmP09tQOkSs8Mab+EJEXJ73Yf019sb7LGymZmJgNyr+0BGu5Dlb7IOB1ITdJGFMcoV2C6Y/0M2Ak/VMsvV3PKqZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749111131; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=nq5OdzKhBFOIm+/LXXZhZ804/dHTLBGbCwh5+zPwOd8=; b=Cu9EJAord8Tf2bjuEWxRtBww5k5egekYM2+43EE7KK+5rUK+n/oHW3h4j6CBkr+iBJEDpP5y0xuMzoB1qD1GWyob+suGX/ukL+2vfyJcxHaiPmkBXS328OWgkxI6iMk+YIRSxUQpFlmLvI3vIikLPOdX5dToVmE5ygo7kRJIX4Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 174911113136078.91279274358908; Thu, 5 Jun 2025 01:12:11 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6BD2813FF; Thu, 5 Jun 2025 04:12:10 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EDF5813EA; Thu, 5 Jun 2025 04:11:03 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 80D63608; Thu, 5 Jun 2025 04:10:55 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 1FF98448 for ; Thu, 5 Jun 2025 04:10:55 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-465-vUxkNtl3PcCO4h8aThDmHw-1; Thu, 05 Jun 2025 04:10:53 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 924E418002B4 for ; Thu, 5 Jun 2025 08:10:52 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.44.22.3]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C234C18002A5 for ; Thu, 5 Jun 2025 08:10:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749111054; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VpRl85hkGFQct+4mBRanfYXnsyEK/yPWrHX5iYRrScg=; b=WNNrQjS8yYBsbV+1fDtqZmz38DmXemEyAgJN+Tj2OVVpCmTF3QSxOCTgRSjtDaY3fH3RAb AvJhC5Oa8la+H3y2RASRSnHp5Z0paEqmdeJ+RRqbfefVa2LHyZ3d2XRyOfd3y7CXXnB/1b vjwlYn5bmwC8qYLN+rUruUe20NM8+VM= X-MC-Unique: vUxkNtl3PcCO4h8aThDmHw-1 X-Mimecast-MFC-AGG-ID: vUxkNtl3PcCO4h8aThDmHw_1749111052 To: devel@lists.libvirt.org Subject: [PATCH 2/7] virthread: Add infrastructure for static virCond definitions Date: Thu, 5 Jun 2025 10:10:42 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: W-llF79cdJOlqvjoBAl2KjYqrRQV4K_SR9vI69fb0Sc_1749111052 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: XGSHTFYV3Q5QBDCBHBPQRKSSYGCK7MZI X-Message-ID-Hash: XGSHTFYV3Q5QBDCBHBPQRKSSYGCK7MZI X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1749111133285116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Add the automatic cleanup handler as well as static initializer to allow simple stack allocated conditions. Signed-off-by: Peter Krempa --- src/util/virthread.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/virthread.h b/src/util/virthread.h index a7ec6bf32c..9e4e8cdafe 100644 --- a/src/util/virthread.h +++ b/src/util/virthread.h @@ -73,6 +73,11 @@ struct virOnceControl { .once =3D PTHREAD_ONCE_INIT \ } +#define VIR_COND_INITIALIZER \ + { \ + .cond =3D PTHREAD_COND_INITIALIZER \ + } + typedef void (*virOnceFunc)(void); typedef void (*virThreadFunc)(void *opaque); @@ -142,6 +147,7 @@ void virRWLockUnlock(virRWLock *m); int virCondInit(virCond *c) G_GNUC_WARN_UNUSED_RESULT; int virCondDestroy(virCond *c); +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virCond, virCondDestroy); /* virCondWait, virCondWaitUntil: * These functions can return without the associated predicate --=20 2.49.0