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 mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users

Reply via email to