Skip to content

Commit

Permalink
Merge pull request godotengine#96225 from RandomShaper/wtp_fix_yield
Browse files Browse the repository at this point in the history
WorkerThreadPool: Fix end-of-yield logic potentially leading to deadlocks
  • Loading branch information
akien-mga committed Aug 28, 2024
2 parents 9f05ca9 + 5dade0e commit e439154
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/object/worker_thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,10 @@ void WorkerThreadPool::_wait_collaboratively(ThreadData *p_caller_pool_thread, T
p_caller_pool_thread->signaled = false;

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) {
// 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.
Expand Down

0 comments on commit e439154

Please sign in to comment.