|
Boost Users : |
From: Aniruddh Agarwal (ani_at_[hidden])
Date: 2020-07-09 13:48:38
Hello,
One strategy to load-balance I/O processing across multiple
threads is to use a single io_context object for multiplexing and
to call io_context::run from all threads in the thread pool. This
can be set up by, for example, defining a type which holds a
vector of threads, all of which are calling io_context::run. My
first question is: is this approach of calling io_context::run
from several threads somewhat equivalent to using
boost::asio::thread_pool as the default execution context and
not (explicitly, at least) creating a boost::asio::io_context
object at all?
Somewhat more specifically, is it safe to define TCP
sockets/acceptors/etc. with execution contexts set to a
boost::asio::thread_pool instead of io_context, and will that
work as expected (i.e., as a single io_context object scheduling
tasks out to several threads calling io_context::run would)?
-Ani
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net