From 391d50cd26a57b36deee48da1548aa7da88d1a1d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 21 Apr 2009 21:25:01 +0200 Subject: mutex: add initializer for static mutexes --- src/pulsecore/mutex.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/pulsecore/mutex.h') diff --git a/src/pulsecore/mutex.h b/src/pulsecore/mutex.h index a4dd6738..b1edc132 100644 --- a/src/pulsecore/mutex.h +++ b/src/pulsecore/mutex.h @@ -46,10 +46,14 @@ void pa_cond_free(pa_cond *c); void pa_cond_signal(pa_cond *c, int broadcast); int pa_cond_wait(pa_cond *c, pa_mutex *m); +/* Static mutexes are basically just atomically updated pointers to pa_mutex objects */ + typedef struct pa_static_mutex { pa_atomic_ptr_t ptr; } pa_static_mutex; +#define PA_STATIC_MUTEX_INIT { PA_ATOMIC_PTR_INIT(NULL) } + pa_mutex* pa_static_mutex_get(pa_static_mutex *m, pa_bool_t recursive, pa_bool_t inherit_priority); #endif -- cgit