Boost logo

Boost :

From: Christian Mazakas (christian.mazakas_at_[hidden])
Date: 2023-07-27 19:05:05


> Yes. You need to resume the awaiting coroutine on the thread that
> called await_resume,
> and you'd usually do that through posting to it's executor.

Alright, I think a good next step would be formalizing this in the library then.

We can go ahead and call this kind of abstraction Waker or something
to that effect.

And then ideally this is featured in the docs.

Formalizing this Waker mechanism has the benefit that the user doesn't
have to think
about the lifetime of the awaiting coroutine. Because Async seems to
support cancellation,
the awaiting coroutine can be cancelled and destroyed before the
external work `post()`s
the `coroutine_handle` for execution. Naively calling `.resume()` is
unsafe without some
form of guarantee around lifetime.

- Christian


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