27 pool_size = std::thread::hardware_concurrency();
29 for (
auto i = 0U; i < pool_size; i++) {
40 std::packaged_task<void()> ptask{std::move(task)};
41 auto res = ptask.get_future();
43 tasks_.emplace_back(std::move(ptask));
55 if (thread.joinable())
69 catch (std::runtime_error &e) {
79 throw std::runtime_error(
"Thread pool closing...");
84 auto res = std::move(
tasks_.front());