A smart pointer is not required to hold the work.
This commit is contained in:
parent
8737ab0f2f
commit
0fe8f4ded4
@ -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)
|
for (std::size_t i = 0; i < pool_size; ++i)
|
||||||
{
|
{
|
||||||
io_context_ptr io_context(new asio::io_context);
|
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);
|
io_contexts_.push_back(io_context);
|
||||||
work_.push_back(work);
|
work_.push_back(asio::make_work_guard(*io_context));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,13 +40,12 @@ private:
|
|||||||
typedef boost::shared_ptr<asio::io_context> io_context_ptr;
|
typedef boost::shared_ptr<asio::io_context> io_context_ptr;
|
||||||
typedef asio::executor_work_guard<
|
typedef asio::executor_work_guard<
|
||||||
asio::io_context::executor_type> io_context_work;
|
asio::io_context::executor_type> io_context_work;
|
||||||
typedef boost::shared_ptr<io_context_work> work_ptr;
|
|
||||||
|
|
||||||
/// The pool of io_contexts.
|
/// The pool of io_contexts.
|
||||||
std::vector<io_context_ptr> io_contexts_;
|
std::vector<io_context_ptr> io_contexts_;
|
||||||
|
|
||||||
/// The work that keeps the io_contexts running.
|
/// 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.
|
/// The next io_context to use for a connection.
|
||||||
std::size_t next_io_context_;
|
std::size_t next_io_context_;
|
||||||
|
Loading…
Reference in New Issue
Block a user