From: Peter Krempa Date: Wed, 4 Jun 2025 19:56:25 +0000 (+0200) Subject: virthread: Register auto cleanup function for virMutex X-Git-Tag: v11.5.0-rc1~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e44bb74f75382d143f0b530b990f9c710165087;p=thirdparty%2Flibvirt.git virthread: Register auto cleanup function for virMutex This makes it very convenient to declare a mutex on stack along with the VIR_MUTEX_INITIALIZE macro without the need to have complex cleanup. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/util/virthread.h b/src/util/virthread.h index 23abe0b6c9..a7ec6bf32c 100644 --- a/src/util/virthread.h +++ b/src/util/virthread.h @@ -121,6 +121,7 @@ int virOnce(virOnceControl *once, virOnceFunc init) int virMutexInit(virMutex *m) G_GNUC_WARN_UNUSED_RESULT; int virMutexInitRecursive(virMutex *m) G_GNUC_WARN_UNUSED_RESULT; void virMutexDestroy(virMutex *m); +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virMutex, virMutexDestroy); void virMutexLock(virMutex *m); void virMutexUnlock(virMutex *m);