Kaynağa Gözat

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

Pedro J. Estébanez 1 yıl önce
ebeveyn
işleme
5dade0e08b
1 değiştirilmiş dosya ile 4 ekleme ve 1 silme
  1. 4 1
      core/object/worker_thread_pool.cpp

+ 4 - 1
core/object/worker_thread_pool.cpp

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