From e023ba30e38c214166176a654cbef97cd625ddb7 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 18 Oct 2021 10:17:00 -0400 Subject: [PATCH] TT#14008 don't wake up all threads during non-wait main sleep Change-Id: Id55cc0e295b586f67d30510ee37572d311a467a2 (cherry picked from commit a152f8b07f9b8f143d43ecd2537106cc44d169f1) --- daemon/aux.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/daemon/aux.c b/daemon/aux.c index 594a3f2d7..3078520bf 100644 --- a/daemon/aux.c +++ b/daemon/aux.c @@ -138,14 +138,16 @@ void threads_join_all(int wait) { GList *l; while (1) { - mutex_lock(&thread_wakers_lock); - for (l = thread_wakers; l; l = l->next) { - struct thread_waker *wk = l->data; - mutex_lock(wk->lock); - cond_broadcast(wk->cond); - mutex_unlock(wk->lock); + if (wait) { + mutex_lock(&thread_wakers_lock); + for (l = thread_wakers; l; l = l->next) { + struct thread_waker *wk = l->data; + mutex_lock(wk->lock); + cond_broadcast(wk->cond); + mutex_unlock(wk->lock); + } + mutex_unlock(&thread_wakers_lock); } - mutex_unlock(&thread_wakers_lock); mutex_lock(&threads_lists_lock); while (threads_to_join) {