diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2023-05-11 12:24:59 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2023-05-11 16:10:09 +0200 |
commit | 9077bb9232bd7f4301f5dc511467e07fc42b388b (patch) | |
tree | 33e70fc70a244fab89133a51b7f315f5796ccfcd /main | |
parent | f717cc0a38862a038ae519f2a1e788a6f520fffc (diff) | |
download | redot-engine-9077bb9232bd7f4301f5dc511467e07fc42b388b.tar.gz |
Fix multiple issues in WorkerThreadPool
- Fix project settings being ignored.
- Made usages of `native_thread_allocator` thread-safe.
- Remove redundant thread-safety from `low_priority_threads_used`, `exit_threads`.
- Fix deadlock due to unintended extra lock of `task_mutex`.
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp index 86de6497d0..b9f2daf020 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1454,6 +1454,19 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #endif } + // Initialize WorkerThreadPool. + { + int worker_threads = GLOBAL_GET("threading/worker_pool/max_threads"); + bool low_priority_use_system_threads = GLOBAL_GET("threading/worker_pool/use_system_threads_for_low_priority_tasks"); + float low_property_ratio = GLOBAL_GET("threading/worker_pool/low_priority_thread_ratio"); + + if (editor || project_manager) { + WorkerThreadPool::get_singleton()->init(); + } else { + WorkerThreadPool::get_singleton()->init(worker_threads, low_priority_use_system_threads, low_property_ratio); + } + } + // Initialize user data dir. OS::get_singleton()->ensure_user_data_dir(); |