diff --git a/core/os/thread_pool.cpp b/core/os/thread_pool.cpp index a1a49056e..baa068df6 100644 --- a/core/os/thread_pool.cpp +++ b/core/os/thread_pool.cpp @@ -113,16 +113,17 @@ bool ThreadPool::is_working_no_lock() const { } bool ThreadPool::has_job(const Ref &job) { + _THREAD_SAFE_LOCK_ + for (int i = 0; i < _threads.size(); ++i) { ThreadPoolContext *context = _threads.get(i); if (context->job == job) { + _THREAD_SAFE_UNLOCK_ return true; } } - _THREAD_SAFE_LOCK_ - List>::Element *E = _queue.find(job); _THREAD_SAFE_UNLOCK_