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]>
wrote:

> 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
here:
https://github.com/sorf/cpp-dev-new/commit/52cebd112a4427bd9b7f3d1ef1e9c391aeffd958
Self contained program here: https://wandbox.org/permlink/RSghEe81IQRxpZfh

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
parameter.

Thanks,
Sorin



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