You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-21 14:57:09 +00:00
Add WorkerThreadPool::get_thread_index()
This commit is contained in:
@@ -535,6 +535,11 @@ void WorkerThreadPool::wait_for_group_task_completion(GroupID p_group) {
|
|||||||
task_mutex.unlock();
|
task_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WorkerThreadPool::get_thread_index() {
|
||||||
|
Thread::ID tid = Thread::get_caller_id();
|
||||||
|
return singleton->thread_ids.has(tid) ? singleton->thread_ids[tid] : -1;
|
||||||
|
}
|
||||||
|
|
||||||
void WorkerThreadPool::init(int p_thread_count, bool p_use_native_threads_low_priority, float p_low_priority_task_ratio) {
|
void WorkerThreadPool::init(int p_thread_count, bool p_use_native_threads_low_priority, float p_low_priority_task_ratio) {
|
||||||
ERR_FAIL_COND(threads.size() > 0);
|
ERR_FAIL_COND(threads.size() > 0);
|
||||||
if (p_thread_count < 0) {
|
if (p_thread_count < 0) {
|
||||||
|
|||||||
@@ -197,6 +197,8 @@ public:
|
|||||||
_FORCE_INLINE_ int get_thread_count() const { return threads.size(); }
|
_FORCE_INLINE_ int get_thread_count() const { return threads.size(); }
|
||||||
|
|
||||||
static WorkerThreadPool *get_singleton() { return singleton; }
|
static WorkerThreadPool *get_singleton() { return singleton; }
|
||||||
|
static int get_thread_index();
|
||||||
|
|
||||||
void init(int p_thread_count = -1, bool p_use_native_threads_low_priority = true, float p_low_priority_task_ratio = 0.3);
|
void init(int p_thread_count = -1, bool p_use_native_threads_low_priority = true, float p_low_priority_task_ratio = 0.3);
|
||||||
void finish();
|
void finish();
|
||||||
WorkerThreadPool();
|
WorkerThreadPool();
|
||||||
|
|||||||
Reference in New Issue
Block a user