From edbfd180d0b700764cd84295080c8a810b85e32e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 4 Apr 2023 12:20:56 +0200 Subject: [PATCH] thread-loop: only restore recurse on error Only restore the previous recurse state when we fail to unlock. --- src/pipewire/thread-loop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pipewire/thread-loop.c b/src/pipewire/thread-loop.c index 0705baaeb..48849f108 100644 --- a/src/pipewire/thread-loop.c +++ b/src/pipewire/thread-loop.c @@ -60,10 +60,10 @@ static int do_unlock(struct pw_thread_loop *this) int res; spa_return_val_if_fail(this->recurse > 0, -EIO); this->recurse--; - if ((res = pthread_mutex_unlock(&this->lock)) != 0) + if ((res = pthread_mutex_unlock(&this->lock)) != 0) { pw_log_error("%p: thread:%lu: %s", this, pthread_self(), strerror(res)); - else this->recurse++; + } return -res; }