diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-06-11 12:08:37 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-06-11 12:08:37 +0000 |
commit | 00da37f2c448096cdd54481b072db47b2f253141 (patch) | |
tree | cb6c51231fa498831b3e63660105ec00ea98d8f5 /src/pulsecore/once.h | |
parent | 6aeec56708f4af2da0b83fdd65a0d153b9bed272 (diff) |
Merge HUGE set of changes temporarily into a branch, to allow me to move them from one machine to another (lock-free and stuff)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1469 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/once.h')
-rw-r--r-- | src/pulsecore/once.h | 12 |
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); |