Add THREADS_ENABLED macro in order to compile Godot to run on the main thread

This commit is contained in:
Adam Scott 2023-12-01 13:39:09 -05:00
parent 107f2961cc
commit bd70b8e1f6
No known key found for this signature in database
GPG key ID: 1352C2919D96DDDF
33 changed files with 447 additions and 72 deletions

View file

@ -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