diff options
-rw-r--r-- | core/os/os.h | 1 | ||||
-rw-r--r-- | core/templates/thread_work_pool.cpp | 2 | ||||
-rw-r--r-- | platform/javascript/os_javascript.h | 1 |
3 files changed, 3 insertions, 1 deletions
diff --git a/core/os/os.h b/core/os/os.h index 52bf731501..abfa7ac993 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -298,6 +298,7 @@ public: virtual void set_exit_code(int p_code); virtual int get_processor_count() const; + virtual int get_default_thread_pool_size() const { return get_processor_count(); } virtual String get_unique_id() const; diff --git a/core/templates/thread_work_pool.cpp b/core/templates/thread_work_pool.cpp index 17969a2c90..710f043a4a 100644 --- a/core/templates/thread_work_pool.cpp +++ b/core/templates/thread_work_pool.cpp @@ -47,7 +47,7 @@ void ThreadWorkPool::_thread_function(void *p_user) { void ThreadWorkPool::init(int p_thread_count) { ERR_FAIL_COND(threads != nullptr); if (p_thread_count < 0) { - p_thread_count = OS::get_singleton()->get_processor_count(); + p_thread_count = OS::get_singleton()->get_default_thread_pool_size(); } thread_count = p_thread_count; diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index d053082d92..aacf87e6c5 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -75,6 +75,7 @@ public: Error kill(const ProcessID &p_pid) override; int get_process_id() const override; int get_processor_count() const override; + int get_default_thread_pool_size() const override { return 1; } String get_executable_path() const override; Error shell_open(String p_uri) override; |