1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Fixes HashMap::erase related race condition in WorkerThreadPool when Physics 2D or 3D is selected to run on a separate thread.

This commit is contained in:
Simo Haasanen
2022-10-20 17:47:20 +01:00
parent a8c805be29
commit 4cc3489bc0

View File

@@ -402,7 +402,9 @@ void WorkerThreadPool::wait_for_group_task_completion(GroupID p_group) {
} }
} }
groups.erase(p_group); // Threads do not access this, so safe to erase here. task_mutex.lock(); // This mutex is needed when Physics 2D and/or 3D is selected to run on a separate thread.
groups.erase(p_group);
task_mutex.unlock();
} }
void WorkerThreadPool::init(int p_thread_count, bool p_use_native_threads_low_priority, float p_low_priority_task_ratio) { void WorkerThreadPool::init(int p_thread_count, bool p_use_native_threads_low_priority, float p_low_priority_task_ratio) {