|
Boost Users : |
Subject: Re: [Boost-users] Passing io_service to socket in implementation file after initialization in header file
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2018-06-18 23:37:36
On 19/06/2018 07:34, james wrote:
> No, not per socket. One per port that accepts connections if you're a
> server, and one per host you're connecting to if you're a client.
While you *can* do that, it's unusual and doesn't really provide any
particular benefit over the models that Vinnie specified.
Essentially, if you make one thread per endpoint then you have the same
thing as the "one io_context per thread" model that Vinnie spoke of.
If you have multiple independent threadpools per endpoint then you have
the combination of the "one io_context per thread" and "one io_context,
multiple threads" models (which works, but is still unusual as you start
to run into more drawbacks than benefits with this pattern; so I
wouldn't recommend it).
Otherwise, you have multiple io_contexts per thread, which is a Bad Ideaâ¢.
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