]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/mutex.h
Merge remote branch 'mkbosmans/rate-adjustment'
[pulseaudio] / src / pulsecore / mutex.h
index 9ca8fae517819f802f091003f1b0eb43e123e8fe..b1edc13237512d1c76ac1c1fffc4f87c496ed4e5 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef foopulsemutexhfoo
 #define foopulsemutexhfoo
 
-/* $Id$ */
-
 /***
   This file is part of PulseAudio.
 
@@ -10,7 +8,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
-  published by the Free Software Foundation; either version 2 of the
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -25,6 +23,7 @@
 ***/
 
 #include <pulsecore/macro.h>
+#include <pulsecore/atomic.h>
 
 typedef struct pa_mutex pa_mutex;
 
@@ -47,4 +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