From 144977414171cb27165fdc7ee65318d2fb25922e 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)) {