From: Peter Krempa <pkre...@redhat.com> Add the automatic cleanup handler as well as static initializer to allow simple stack allocated conditions.
Signed-off-by: Peter Krempa <pkre...@redhat.com> --- 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 = PTHREAD_ONCE_INIT \ } +#define VIR_COND_INITIALIZER \ + { \ + .cond = 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 -- 2.49.0