forked from pool/alsa-utils
Takashi Iwai
f84c139643
- Backport upstream fixes: a few fixes for chmap support, alsaconf updates, a new monitor command for alsactl, etc: 0006-amixer-fix-indentation-when-printing-container-TLV-c.patch 0007-alsaloop-pcmjob.c-use-portable-way-to-initialize-rec.patch 0008-speaker-test-Fix-chmapped-channel-selection-without-.patch 0009-speaker-test-Always-show-chmap-channel-names-if-avai.patch 0010-speaker-test-Show-out-of-chmap-channels-as-Unknown.patch 0011-alsaconf-support-newer-m-i-t-and-kmod.patch 0012-alsaconf-update-gentoo-to-use-modprobe.d-method-as-e.patch 0013-configure-detect-udevdir-via-pkg-config-fallback-to-.patch 0014-alsactl-Add-monitor-command.patch 0015-alsactl-Fix-REMOVE-event-handling-in-monitor-command.patch 0016-alsactl-monitor-all-cards-as-default.patch OBS-URL: https://build.opensuse.org/request/show/208681 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=94
56 lines
1.7 KiB
Diff
56 lines
1.7 KiB
Diff
From 0616d87fbaae1d4a558104051cb5369504eb2068 Mon Sep 17 00:00:00 2001
|
|
From: John Spencer <maillist-alsa@barfooze.de>
|
|
Date: Fri, 8 Nov 2013 13:59:41 +0100
|
|
Subject: [PATCH] alsaloop: pcmjob.c: use portable way to initialize recursive
|
|
mutex
|
|
|
|
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not in POSIX, as _NP
|
|
(non-portable) suggests.
|
|
|
|
exposing such a symbol in musl libc would lock in the ABI for all
|
|
times and makes it impossible to do future changes to the under-
|
|
lying struct without hideous symbol versioning hacks.
|
|
|
|
use the portable way instead: pthread_once was designed for such
|
|
cases.
|
|
|
|
Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
|
|
Tested-by: John Spencer <maillist-alsa@barfooze.de>
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
alsaloop/pcmjob.c | 15 +++++++++++++--
|
|
1 file changed, 13 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c
|
|
index 139b6fdf087e..f32180c8e8cd 100644
|
|
--- a/alsaloop/pcmjob.c
|
|
+++ b/alsaloop/pcmjob.c
|
|
@@ -62,11 +62,22 @@ static const char *src_types[] = {
|
|
};
|
|
#endif
|
|
|
|
-static pthread_mutex_t pcm_open_mutex =
|
|
- PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
|
|
+static pthread_once_t pcm_open_mutex_once = PTHREAD_ONCE_INIT;
|
|
+static pthread_mutex_t pcm_open_mutex;
|
|
+
|
|
+static void pcm_open_init_mutex(void)
|
|
+{
|
|
+ pthread_mutexattr_t attr;
|
|
+
|
|
+ pthread_mutexattr_init(&attr);
|
|
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
|
+ pthread_mutex_init(&pcm_open_mutex, &attr);
|
|
+ pthread_mutexattr_destroy(&attr);
|
|
+}
|
|
|
|
static inline void pcm_open_lock(void)
|
|
{
|
|
+ pthread_once(&pcm_open_mutex_once, pcm_open_init_mutex);
|
|
if (workarounds & WORKAROUND_SERIALOPEN)
|
|
pthread_mutex_lock(&pcm_open_mutex);
|
|
}
|
|
--
|
|
1.8.4.3
|
|
|