When not using threading just return the head of the queue in get_running_job.

This commit is contained in:
Relintai 2020-05-24 19:58:09 +02:00
parent 61fffea0a4
commit c69a2a9db4

View File

@ -132,6 +132,9 @@ void ThreadPool::cancel_task(Ref<ThreadPoolJob> job) {
} }
Ref<ThreadPoolJob> ThreadPool::get_running_job(const Variant &object, const StringName &method) { Ref<ThreadPoolJob> ThreadPool::get_running_job(const Variant &object, const StringName &method) {
if (!_use_threads)
return _queue[_current_queue_head];
for (int i = 0; i < _threads.size(); ++i) { for (int i = 0; i < _threads.size(); ++i) {
Ref<ThreadPoolJob> j = _threads[i]->job; Ref<ThreadPoolJob> j = _threads[i]->job;