From f28dd32275c1feba4854abad30ff5e21a7b39440 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Mon, 22 Mar 2021 21:00:48 -0300 Subject: common/thread_worker: Add wait for requests method --- src/common/thread_worker.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/common/thread_worker.h') diff --git a/src/common/thread_worker.h b/src/common/thread_worker.h index f1859971f..7a6756eb5 100644 --- a/src/common/thread_worker.h +++ b/src/common/thread_worker.h @@ -18,12 +18,14 @@ public: explicit ThreadWorker(std::size_t num_workers, const std::string& name); ~ThreadWorker(); void QueueWork(std::function&& work); + void WaitForRequests(); private: std::vector threads; std::queue> requests; std::mutex queue_mutex; std::condition_variable condition; + std::condition_variable wait_condition; std::atomic_bool stop{}; }; -- cgit v1.2.3