summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2024-04-17 18:32:14 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2024-04-17 18:32:14 +0200
commit9653bcaa4300a36afe1af0df83fd88ce5b4f0f74 (patch)
treebaf60677e66cf4b39ab9e73e45739ebaa68171df
parent4b7776e31bf91bd3d710277b505c196b38d8fff3 (diff)
downloadredot-engine-9653bcaa4300a36afe1af0df83fd88ce5b4f0f74.tar.gz
WorkerThreadPool: Polish yielding (fix corner case, remove misleading warning)
-rw-r--r--core/object/worker_thread_pool.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/object/worker_thread_pool.cpp b/core/object/worker_thread_pool.cpp
index c10f491a11..e0b8730a67 100644
--- a/core/object/worker_thread_pool.cpp
+++ b/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;