Merge pull request #67680 from haasanen/fix_physics_thread_race_condition

Fix physics/3d/run_on_separate_thread race condition in WorkerThreadPool (crash).
This commit is contained in:
Rémi Verschelde 2022-11-29 13:41:56 +01:00
commit 6fdbf79046
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 3 additions and 1 deletions

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) {