diff options
author | Adam Scott <ascott.ca@gmail.com> | 2024-11-18 22:27:17 -0500 |
---|---|---|
committer | Adam Scott <ascott.ca@gmail.com> | 2024-11-18 22:27:17 -0500 |
commit | 4988fa1ece653938e07ee3bbc89a9bafea5ef7ea (patch) | |
tree | 848323a50433cfdf19a6ac8403ef30516223e075 /core | |
parent | fd4c29a189e53a1e085df5b9b9a05cac9351b3ef (diff) | |
download | redot-engine-4988fa1ece653938e07ee3bbc89a9bafea5ef7ea.tar.gz |
Force `get_thread_count()` to `1` if single threaded
Diffstat (limited to 'core')
-rw-r--r-- | core/object/worker_thread_pool.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/object/worker_thread_pool.h b/core/object/worker_thread_pool.h index 62296ac040..58e86e3e48 100644 --- a/core/object/worker_thread_pool.h +++ b/core/object/worker_thread_pool.h @@ -258,7 +258,13 @@ public: bool is_group_task_completed(GroupID p_group) const; void wait_for_group_task_completion(GroupID p_group); - _FORCE_INLINE_ int get_thread_count() const { return threads.size(); } + _FORCE_INLINE_ int get_thread_count() const { +#ifdef THREADS_ENABLED + return threads.size(); +#else + return 1; +#endif + } static WorkerThreadPool *get_singleton() { return singleton; } static int get_thread_index(); |