A smart pointer is not required to hold the work.

This commit is contained in:
Christopher Kohlhoff 2016-09-24 09:51:39 +10:00
parent 8737ab0f2f
commit 0fe8f4ded4
2 changed files with 2 additions and 4 deletions

View File

@ -27,9 +27,8 @@ io_context_pool::io_context_pool(std::size_t pool_size)
for (std::size_t i = 0; i < pool_size; ++i)
{
io_context_ptr io_context(new asio::io_context);
work_ptr work(new io_context_work(asio::make_work_guard(*io_context)));
io_contexts_.push_back(io_context);
work_.push_back(work);
work_.push_back(asio::make_work_guard(*io_context));
}
}

View File

@ -40,13 +40,12 @@ private:
typedef boost::shared_ptr<asio::io_context> io_context_ptr;
typedef asio::executor_work_guard<
asio::io_context::executor_type> io_context_work;
typedef boost::shared_ptr<io_context_work> work_ptr;
/// The pool of io_contexts.
std::vector<io_context_ptr> io_contexts_;
/// The work that keeps the io_contexts running.
std::vector<work_ptr> work_;
std::vector<io_context_work> work_;
/// The next io_context to use for a connection.
std::size_t next_io_context_;