summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/once.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsecore/once.h')
-rw-r--r--src/pulsecore/once.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/pulsecore/once.h b/src/pulsecore/once.h
index c20fc0b4..b2602121 100644
--- a/src/pulsecore/once.h
+++ b/src/pulsecore/once.h
@@ -25,13 +25,19 @@
***/
#include <pulsecore/mutex.h>
+#include <pulsecore/atomic.h>
typedef struct pa_once {
- unsigned int once_value;
- pa_mutex *mutex;
+ pa_atomic_ptr_t mutex;
+ pa_atomic_t ref, done;
} pa_once_t;
-#define PA_ONCE_INIT { .once_value = 0, .mutex = NULL }
+#define PA_ONCE_INIT \
+ { \
+ .mutex = PA_ATOMIC_PTR_INIT(NULL), \
+ .ref = PA_ATOMIC_INIT(0), \
+ .done = PA_ATOMIC_INIT(0) \
+ }
typedef void (*pa_once_func_t) (void);