WorkerThreadPool: Fix end-of-yield logic potentially leading to deadlocks

(cherry picked from commit 5dade0e08b)
This commit is contained in:
Pedro J. Estébanez 2024-08-28 15:26:08 +02:00 committed by Rémi Verschelde
parent f273c7c773
commit 2c612abdd1
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 4 additions and 1 deletions

View File

@ -468,7 +468,10 @@ void WorkerThreadPool::_wait_collaboratively(ThreadData *p_caller_pool_thread, T
p_caller_pool_thread->signaled = false; p_caller_pool_thread->signaled = false;
if (IS_WAIT_OVER) { if (IS_WAIT_OVER) {
p_caller_pool_thread->yield_is_over = false; if (unlikely(p_task == ThreadData::YIELDING)) {
p_caller_pool_thread->yield_is_over = false;
}
if (!exit_threads && was_signaled) { if (!exit_threads && was_signaled) {
// This thread was awaken for some additional reason, but it's about to exit. // This thread was awaken for some additional reason, but it's about to exit.
// Let's find out what may be pending and forward the requests. // Let's find out what may be pending and forward the requests.