diff --git a/ThreadPool.h b/ThreadPool.h index b2cea78..82acd0c 100644 --- a/ThreadPool.h +++ b/ThreadPool.h @@ -69,15 +69,15 @@ auto ThreadPool::enqueue(F&& f, Args&&... args) std::bind(std::forward(f), std::forward(args)...) ); - std::future res = task->get_future(); + std::future res = task->get_future(); { - std::unique_lock lock(queue_mutex); + std::unique_lock lock(queue_mutex); tasks.push([task](){ (*task)(); }); } condition.notify_one(); return res; } - + // the destructor joins all threads inline ThreadPool::~ThreadPool() {