From c69a2a9db422bdad9e0d6428a4888aaec896659b Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 24 May 2020 19:58:09 +0200 Subject: [PATCH] When not using threading just return the head of the queue in get_running_job. --- thread_pool.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/thread_pool.cpp b/thread_pool.cpp index a2c0973..46cfe21 100644 --- a/thread_pool.cpp +++ b/thread_pool.cpp @@ -132,6 +132,9 @@ void ThreadPool::cancel_task(Ref job) { } Ref 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) { Ref j = _threads[i]->job;