From: Klemens Morgenstern (klemensdavidmorgenstern_at_[hidden])
Date: 2023-07-27 18:08:48


On Fri, Jul 28, 2023 at 1:04 AM Christian Mazakas via Boost
<boost_at_[hidden]> wrote:
>
> I think I may've misunderstood everything.
>
> I was under the impression that Async could support custom
> awaitables but I don't believe it can.

It definitely can.

>
> Or at least, I'd need to see an actual example of this being
> authored.

Sure, I probably need to add some example of multi-threading support.
>
> Purport that I wanted to author an awaitable that spawned
> work on a thread pool in its `await_suspend()` method. Do I
> just use the awaiting coro's executor to post() back to Async's
> event loop? What should I actually be posting back? Just a
> simple callable that invokes `h.resume()`?
>

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.

Technically you can just post the coroutine handle as it has an operator().