Boost logo

Boost :

From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2023-08-17 19:13:21


niedz., 13 sie 2023 o 11:32 Andrzej Krzemienski <akrzemi1_at_[hidden]>
napisał(a):

> Hi Everyone,
> I would like to thank Klemens for writing and sharing this library. I am
> sure the community needs a higher level library for asynchronous
> computations based on C++20 coroutines. Boost.Async addresses the need. I
> would like to ask a couple of questions to better understand the design
> goals and the scope of the library.
>
> Q1. Is single-threaded-ness the design goal? Or is the plan to enable
> multi-threaded use cases? There is a GitHub issue (
> https://github.com/klemens-morgenstern/async/issues/19) suggesting the
> latter.
>
> Q2. Reading through the docs, I get an impression that Boost.Async is
> "Either a wrapper over ASIO, or an isolated usage for a generator". They
> seem like two unrelated worlds. The former requires a hard prerequisite of
> having a Boost.ASIO library (with Boost version at least 1.82). The latter
> can hardly be called "asynchronous". Generators, the way I understand them,
> are perfectly synchronous. Is this impression correct?
>
> The following are more remarks regarding the choice of names.
>
> Q3. The docs say that `promise` and `task` differ primarily by their level
> of eagerness. But the names do not seem to reflect this. What is the
> rationale or the intuition behind those names?
>
> R1. I find the name `use_op` uninformative. The examples in documentation
> suggest that it is an *adapter*: they change the Boost.ASIO interface into
> the Boost.Async interface. Is that correct?
>

One more question. This interface of async::generator<Out, In>, taking two
parameters, where one can not only generate values from the generator, but
also obtain values: is there a real-life use case for this?

I tried to use it, but the order of events seems impractical: in order to
generate a new value I have to feed a value:

auto output = co_await generator(input);

But in the generator, I cannot use the provided input to generate the
output. The output corresponding to the passed input would only be
accessible upon the subsequent co_await.

Regards,
&rzej;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk