| 49 | } |
| 50 | |
| 51 | void server::run() |
| 52 | { |
| 53 | // Create a pool of threads to run the io_context. |
| 54 | std::vector<std::thread> threads; |
| 55 | for (std::size_t i = 0; i < thread_pool_size_; ++i) |
| 56 | threads.emplace_back([this]{ io_context_.run(); }); |
| 57 | |
| 58 | // Wait for all threads in the pool to exit. |
| 59 | for (std::size_t i = 0; i < threads.size(); ++i) |
| 60 | threads[i].join(); |
| 61 | } |
| 62 | |
| 63 | void server::do_accept() |
| 64 | { |