]> code.delx.au - pulseaudio/commitdiff
mutex: handle gracefully if a PTHREAD_PRIO_INHERIT protocol cannot be set
authorPino Toscano <toscano.pino@tiscali.it>
Mon, 14 Nov 2011 10:58:25 +0000 (11:58 +0100)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 2 Jan 2012 18:50:04 +0000 (00:20 +0530)
This adds an additional check for unavailable PTHREAD_PRIO_INHERIT to the
fallback work done in ca717643ee768307475fc36ea29d920a13db0a8e

See bug #42715

src/pulsecore/mutex-posix.c

index 634087d9ecebff2b7ea8b0fe234e25261b713613..d90525bf3c95730de19c052578ce895eaaf3f76e 100644 (file)
@@ -50,8 +50,10 @@ pa_mutex* pa_mutex_new(pa_bool_t recursive, pa_bool_t inherit_priority) {
         pa_assert_se(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) == 0);
 
 #ifdef HAVE_PTHREAD_PRIO_INHERIT
-    if (inherit_priority)
-        pa_assert_se(pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT) == 0);
+    if (inherit_priority) {
+        r = pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT);
+        pa_assert(r == 0 || r == ENOTSUP);
+    }
 #endif
 
     m = pa_xnew(pa_mutex, 1);