| 63 | } |
| 64 | |
| 65 | thread_pool::~thread_pool() { |
| 66 | { |
| 67 | std::unique_lock<std::mutex> lock(queue_mutex); |
| 68 | stop = true; |
| 69 | } |
| 70 | |
| 71 | cv.notify_all(); |
| 72 | for (auto &thread: threads) { |
| 73 | thread.join(); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | void thread_pool::enqueue(thread_pool_task task) { |
| 78 | { |