]> code.delx.au - pulseaudio/commitdiff
make pa_mutex_new() and pa_cond_new() succeed in all cases. Similar behaviour to...
authorLennart Poettering <lennart@poettering.net>
Sat, 9 Sep 2006 23:55:58 +0000 (23:55 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 9 Sep 2006 23:55:58 +0000 (23:55 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1389 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/pulsecore/mutex-posix.c

index 6f0e733659584c76b06b46584c4c0c2f60483643..094d637d9a466f9aef50375f3093b0159d57c427 100644 (file)
@@ -52,16 +52,11 @@ pa_mutex* pa_mutex_new(int recursive) {
     pthread_mutexattr_init(&attr);
 
     if (recursive)
-        if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) < 0)
-            return NULL;
+        ASSERT_SUCCESS(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE));
 
     m = pa_xnew(pa_mutex, 1);
 
-    if (pthread_mutex_init(&m->mutex, &attr) < 0) {
-        pa_xfree(m);
-        return NULL;
-    }
-
+    ASSERT_SUCCESS(pthread_mutex_init(&m->mutex, &attr));
     return m;
 }
 
@@ -84,17 +79,12 @@ void pa_mutex_unlock(pa_mutex *m) {
     ASSERT_SUCCESS(pthread_mutex_unlock(&m->mutex));
 }
 
-
 pa_cond *pa_cond_new(void) {
     pa_cond *c;
 
     c = pa_xnew(pa_cond, 1);
 
-    if (pthread_cond_init(&c->cond, NULL) < 0) {
-        pa_xfree(c);
-        return NULL;
-    }
-
+    ASSERT_SUCCESS(pthread_cond_init(&c->cond, NULL));
     return c;
 }