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
This commit is contained in:
Tanu Kaskinen 2020-09-24 12:07:07 +03:00 committed by Arun Raghavan
parent 093dd2f181
commit 757eb26448

View file

@ -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) {