I've been discussing a very similar thing with Vinnie Falco, here: https://github.com/boostorg/beast/issues/1366



On Mon, 17 Dec 2018 at 13:39, Sorin Fetche via Boost-users <boost-users@lists.boost.org> wrote:
Hi,

Is there a way to combine the special use_future completion token with a strand?
Something with the meaning of:
- the asynchronous operation should pass the result to the future it returns, and
- the internal operations of it (if any) should run in a strand

Code snippet:
asio::io_context io_context;
asio::io_context::strand strand(io_context);
std::future<void> f = async_my_operation(io_context, <params>, asio::use_future);
//________________________________________How to add the strand here ^^^ ?
  

The code area where I would like to apply this is in this test program:

The self contained program and its output is here:


As a background, the test program I wrote is based on these Boost.Asio examples:

and implements a composed operation that runs multiple internal operations in parallel and in series. Similar to the constructor of a socket or a timer object, the operation receives as a parameter an io_context; it doesn't offer an overload that receives a strand object directly.

The operation is then tested with callback completion, callback completion in a strand, future and future + strand (where the test fails).

Thank you,
Sorin

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users


--
Richard Hodges
hodges.r@gmail.com
office: +442032898513
home: +376841522
mobile: +376380212 (this will be *expensive* outside Andorra!)
skype: madmongo
facebook: hodges.r