浏览代码

Force `get_thread_count()` to `1` if single threaded

Adam Scott 11 月之前
父节点
当前提交
4988fa1ece
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      core/object/worker_thread_pool.h

+ 7 - 1
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();