summaryrefslogtreecommitdiffstats
path: root/main/main.cpp
diff options
context:
space:
mode:
authorAdam Scott <ascott.ca@gmail.com>2023-12-01 13:39:09 -0500
committerAdam Scott <ascott.ca@gmail.com>2024-01-17 13:58:29 -0500
commitbd70b8e1f643dbf7252be9bc367e0de0f82d722d (patch)
treede81ebb037ede5994d3e817a2a788488d0f47977 /main/main.cpp
parent107f2961ccfac179af7682eb5f6e7ea91e80040c (diff)
downloadredot-engine-bd70b8e1f643dbf7252be9bc367e0de0f82d722d.tar.gz
Add THREADS_ENABLED macro in order to compile Godot to run on the main thread
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/main/main.cpp b/main/main.cpp
index b50def9cec..acd84fc415 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1615,12 +1615,18 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
// Initialize WorkerThreadPool.
- if (editor || project_manager) {
- WorkerThreadPool::get_singleton()->init(-1, 0.75);
- } else {
- int worker_threads = GLOBAL_GET("threading/worker_pool/max_threads");
- float low_priority_ratio = GLOBAL_GET("threading/worker_pool/low_priority_thread_ratio");
- WorkerThreadPool::get_singleton()->init(worker_threads, low_priority_ratio);
+ {
+#ifdef THREADS_ENABLED
+ if (editor || project_manager) {
+ WorkerThreadPool::get_singleton()->init(-1, 0.75);
+ } else {
+ int worker_threads = GLOBAL_GET("threading/worker_pool/max_threads");
+ float low_priority_ratio = GLOBAL_GET("threading/worker_pool/low_priority_thread_ratio");
+ WorkerThreadPool::get_singleton()->init(worker_threads, low_priority_ratio);
+ }
+#else
+ WorkerThreadPool::get_singleton()->init(0, 0);
+#endif
}
#ifdef TOOLS_ENABLED