Merge pull request #54499 from Faless/threads/4.x_work_pool_default

This commit is contained in:
Rémi Verschelde 2021-11-19 09:39:21 +01:00 committed by GitHub
commit fc9de5ba7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View File

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

View File

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

View File

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