소스 검색

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

(cherry picked from commit 5dade0e08b6647cf4b836402a797e9b8f46052b1)
Pedro J. Estébanez 1 년 전
부모
커밋
2c612abdd1
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      core/object/worker_thread_pool.cpp

+ 4 - 1
core/object/worker_thread_pool.cpp

@@ -468,7 +468,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.