Browse Source

WorkerThreadPool: Polish yielding (fix corner case, remove misleading warning)

Pedro J. Estébanez 1 year ago
parent
commit
9653bcaa43
1 changed files with 3 additions and 5 deletions
  1. 3 5
      core/object/worker_thread_pool.cpp

+ 3 - 5
core/object/worker_thread_pool.cpp

@@ -491,12 +491,10 @@ void WorkerThreadPool::notify_yield_over(TaskID p_task_id) {
 		ERR_FAIL_MSG("Invalid Task ID.");
 	}
 	Task *task = *taskp;
-
-#ifdef DEBUG_ENABLED
-	if (task->pool_thread_index == get_thread_index()) {
-		WARN_PRINT("A worker thread is attempting to notify itself. That makes no sense.");
+	if (task->completed) {
+		task_mutex.unlock();
+		return;
 	}
-#endif
 
 	ThreadData &td = threads[task->pool_thread_index];
 	td.yield_is_over = true;