aboutsummaryrefslogtreecommitdiffstats
path: root/main/alsa-lib/alsa-lib-portable-mutex.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/alsa-lib/alsa-lib-portable-mutex.patch')
-rw-r--r--main/alsa-lib/alsa-lib-portable-mutex.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/main/alsa-lib/alsa-lib-portable-mutex.patch b/main/alsa-lib/alsa-lib-portable-mutex.patch
new file mode 100644
index 0000000000..5ef530c38a
--- /dev/null
+++ b/main/alsa-lib/alsa-lib-portable-mutex.patch
@@ -0,0 +1,33 @@
+--- alsa-lib-1.0.27.2.orig/src/conf.c
++++ alsa-lib-1.0.27.2/src/conf.c
+@@ -427,8 +427,8 @@
+ #ifndef DOC_HIDDEN
+
+ #ifdef HAVE_LIBPTHREAD
+-static pthread_mutex_t snd_config_update_mutex =
+- PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
++static pthread_mutex_t snd_config_update_mutex;
++static pthread_once_t snd_config_update_mutex_once = PTHREAD_ONCE_INIT;
+ #endif
+
+ struct _snd_config {
+@@ -472,8 +472,19 @@
+
+ #ifdef HAVE_LIBPTHREAD
+
++static void snd_config_init_mutex(void)
++{
++ pthread_mutexattr_t attr;
++
++ pthread_mutexattr_init(&attr);
++ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
++ pthread_mutex_init(&snd_config_update_mutex, &attr);
++ pthread_mutexattr_destroy(&attr);
++}
++
+ static inline void snd_config_lock(void)
+ {
++ pthread_once(&snd_config_update_mutex_once, snd_config_init_mutex);
+ pthread_mutex_lock(&snd_config_update_mutex);
+ }
+