mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
mutex: add initializer for static mutexes
This commit is contained in:
parent
b304a98854
commit
391d50cd26
2 changed files with 5 additions and 1 deletions
|
|
@ -46,10 +46,14 @@ void pa_cond_free(pa_cond *c);
|
||||||
void pa_cond_signal(pa_cond *c, int broadcast);
|
void pa_cond_signal(pa_cond *c, int broadcast);
|
||||||
int pa_cond_wait(pa_cond *c, pa_mutex *m);
|
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 {
|
typedef struct pa_static_mutex {
|
||||||
pa_atomic_ptr_t ptr;
|
pa_atomic_ptr_t ptr;
|
||||||
} pa_static_mutex;
|
} 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);
|
pa_mutex* pa_static_mutex_get(pa_static_mutex *m, pa_bool_t recursive, pa_bool_t inherit_priority);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include "ratelimit.h"
|
#include "ratelimit.h"
|
||||||
|
|
||||||
static pa_static_mutex mutex;
|
static pa_static_mutex mutex = PA_STATIC_MUTEX_INIT;
|
||||||
|
|
||||||
/* Modelled after Linux' lib/ratelimit.c by Dave Young
|
/* Modelled after Linux' lib/ratelimit.c by Dave Young
|
||||||
* <hidave.darkstar@gmail.com>, which is licensed GPLv2. */
|
* <hidave.darkstar@gmail.com>, which is licensed GPLv2. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue