From 90ae9974c6ebfe977f6f4375a39315eb81c7b975 Mon Sep 17 00:00:00 2001 From: mbutrovich Date: Wed, 20 Jun 2018 10:40:56 -0400 Subject: [PATCH] Relax timeout for thread waiting to not be so aggressive. --- src/threadpool/worker_pool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/threadpool/worker_pool.cpp b/src/threadpool/worker_pool.cpp index 1e798940011..e5696552670 100644 --- a/src/threadpool/worker_pool.cpp +++ b/src/threadpool/worker_pool.cpp @@ -28,7 +28,7 @@ void WorkerFunc(std::string thread_name, std::atomic_bool *is_running, while (is_running->load() || !task_queue->IsEmpty()) { std::unique_lock lock(*cv_lock); - not_empty->wait_for(lock, std::chrono::milliseconds(1), + not_empty->wait_for(lock, std::chrono::seconds(1), [&] { return !task_queue->IsEmpty(); }); std::function task; if (task_queue->Dequeue(task)) {