9#include <condition_variable>
26 std::future<void>
submit(std::function<
void()> f)
28 std::unique_lock<std::mutex> lock(m_queue_mutex);
29 std::packaged_task<void()>
task(std::move(f));
30 std::future<void> res(
task.get_future());
31 m_work_queue.push(std::move(
task));
38 std::atomic_bool m_done;
39 std::queue<std::packaged_task<void()> > m_work_queue;
40 std::mutex m_queue_mutex;
41 std::condition_variable m_cond;
42 std::vector<std::thread> m_threads;
45 void worker_thread(
const int &
id);
Definition: JoinThreads.hpp:8
Definition: ThreadPool.hpp:16
static ThreadPool & get_instance()
Definition: ThreadPool.hpp:20
~ThreadPool()
Definition: ThreadPool.cpp:23
std::future< void > submit(std::function< void()> f)
Definition: ThreadPool.hpp:26
Definition: Executor.cpp:5