You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
WorkerThreadPool: Fix wrong sync logic breaking task map integrity
This commit is contained in:
@@ -397,16 +397,17 @@ Error WorkerThreadPool::wait_for_task_completion(TaskID p_task_id) {
|
|||||||
task->waiting_user++;
|
task->waiting_user++;
|
||||||
}
|
}
|
||||||
|
|
||||||
task_mutex.unlock();
|
|
||||||
|
|
||||||
if (caller_pool_thread) {
|
if (caller_pool_thread) {
|
||||||
|
task_mutex.unlock();
|
||||||
_wait_collaboratively(caller_pool_thread, task);
|
_wait_collaboratively(caller_pool_thread, task);
|
||||||
|
task_mutex.lock();
|
||||||
task->waiting_pool--;
|
task->waiting_pool--;
|
||||||
if (task->waiting_pool == 0 && task->waiting_user == 0) {
|
if (task->waiting_pool == 0 && task->waiting_user == 0) {
|
||||||
tasks.erase(p_task_id);
|
tasks.erase(p_task_id);
|
||||||
task_allocator.free(task);
|
task_allocator.free(task);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
task_mutex.unlock();
|
||||||
task->done_semaphore.wait();
|
task->done_semaphore.wait();
|
||||||
task_mutex.lock();
|
task_mutex.lock();
|
||||||
task->waiting_user--;
|
task->waiting_user--;
|
||||||
@@ -414,9 +415,9 @@ Error WorkerThreadPool::wait_for_task_completion(TaskID p_task_id) {
|
|||||||
tasks.erase(p_task_id);
|
tasks.erase(p_task_id);
|
||||||
task_allocator.free(task);
|
task_allocator.free(task);
|
||||||
}
|
}
|
||||||
task_mutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task_mutex.unlock();
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user