summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2020-09-24 12:07:07 +0300
committerArun Raghavan <arun@arunraghavan.net>2020-11-23 21:25:23 +0000
commit757eb264485b11ca9163a260d8772c59ac3108a1 (patch)
tree9a06db91d5777a159fa3f1b45ed902f419d9adc8
parent093dd2f18180f38df0304946933661b116d314dc (diff)
downloadpulseaudio-757eb264485b11ca9163a260d8772c59ac3108a1.tar.gz
mutex-posix: Log pthread_mutex_unlock() error
This call has been seen failing on FreeBSD, and it's difficult to debug without seeing which error the function returned. Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/988
-rw-r--r--src/pulsecore/mutex-posix.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pulsecore/mutex-posix.c b/src/pulsecore/mutex-posix.c
index a835be1b7..41309a0a3 100644
--- a/src/pulsecore/mutex-posix.c
+++ b/src/pulsecore/mutex-posix.c
@@ -25,6 +25,8 @@
#include <errno.h>
#include <pulse/xmalloc.h>
+
+#include <pulsecore/core-error.h>
#include <pulsecore/macro.h>
#include "mutex.h"
@@ -103,9 +105,14 @@ bool pa_mutex_try_lock(pa_mutex *m) {
}
void pa_mutex_unlock(pa_mutex *m) {
+ int err;
+
pa_assert(m);
- pa_assert_se(pthread_mutex_unlock(&m->mutex) == 0);
+ if ((err = pthread_mutex_unlock(&m->mutex) != 0)) {
+ pa_log("pthread_mutex_unlock() failed: %s", pa_cstrerror(err));
+ pa_assert_not_reached();
+ }
}
pa_cond *pa_cond_new(void) {