From 757eb264485b11ca9163a260d8772c59ac3108a1 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Thu, 24 Sep 2020 12:07:07 +0300 Subject: [PATCH] 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 --- src/pulsecore/mutex-posix.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 #include + +#include #include #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) {