|
Boost Users : |
Subject: Re: [Boost-users] Passing io_service to socket in implementation file after initialization in header file
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2018-06-18 19:08:12
On Mon, Jun 18, 2018 at 11:54 AM james via Boost-users
<boost-users_at_[hidden]> wrote:
> You want one io_service per endpoint, not per application.
What? No... You're saying a separate io_context for each socket?
That's not necessary. These are the common models:
* One io_context, one thread:
- Implicit strand (no locks needed)
* One io_context, multiple threads
- Explicit strand needed
- Different sockets can process data concurrently
* One io_context for each thread
- Implicit strand (no locks needed)
- Sockets in different contexts can process data concurrently
- Passing data between sockets in different contexts requires care
(e.g. broadcasts)
I know of no benefit to one io_context per socket, nor have I seen an
implementation which uses that model.
Thanks
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