#ifndef HTTP_SERVER2_IO_SERVICE_POOL_HPP
#define HTTP_SERVER2_IO_SERVICE_POOL_HPP
#include <boost/asio.hpp>
#include <list>
#include <memory>
#include <vector>
namespace http {
namespace server2 {
class io_context_pool
{
public:
explicit io_context_pool(std::size_t pool_size);
void run();
void stop();
boost::asio::io_context& get_io_context();
private:
io_context_pool(const io_context_pool&) = delete;
io_context_pool& operator=(const io_context_pool&) = delete;
typedef std::shared_ptr<boost::asio::io_context> io_context_ptr;
typedef boost::asio::executor_work_guard<
boost::asio::io_context::executor_type> io_context_work;
std::vector<io_context_ptr> io_contexts_;
std::list<io_context_work> work_;
std::size_t next_io_context_;
};
} }
#endif