Boost logo

Boost Users :

Subject: Re: [Boost-users] [Asio] Combining use_future with strands
From: Sorin Fetche (sorin.fetche_at_[hidden])
Date: 2018-12-18 06:06:54

On Mon, Dec 17, 2018 at 10:26 AM Damian Jarek <damian.jarek93_at_[hidden]>

> Hi Sorin,
> This is a known issue in ASIO - `asio::use_future` has an associated
> executor (which is used to redirect exceptions), but the problem is that
> the implementation doesn't use the `associated_executor` type trait to wrap
> an executor associated with the I/O object that is used. Instead, it uses
> the intrusive executor hook, which "overrides" the executor associated with
> the I/O object. Note that if `bind_executor` were to work with it, it would
> cause the exception redirection to break.

Hi Damian,

Do you know if there is any issue / ticket raised for this so I can track
it over time? I didn't find anything related to use_future neither in the
GitHub issues nor the old Trac.
Based on your description of the problem and some cursory debugging in
use_future, I would expect this to be an implementation issue that could be
addressed at some point.

> As a sidenote: asio::io_context::strand is deprecated and should not be
> used in projects that use ASIO 1.66+. You should use
> `asio::strand<io_context::executor_type>` instead.

I changed this plus added an executor parameter to the composed operation
Self contained program here:

And indeed, it didn't do any help when combining use_future + strand.
At least it showcases two ways of passing the strand when using the
completion callback and the composed operation has an explicit executor


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at