Boost logo

Boost :

From: Klemens Morgenstern (klemensdavidmorgenstern_at_[hidden])
Date: 2023-07-27 16:20:36


On Fri, Jul 28, 2023 at 12:15 AM Christian Mazakas via Boost
<boost_at_[hidden]> wrote:
>
> > See what richard said: you can have asio run on io_uring already. You can then
>
> The problem is, this gets said a lot but no one really understands it.
>
> There's a lot to benefit from io_uring that Asio simply can't support
> so saying that
> "Asio can use io_uring" is technically true but it's largely
> disingenuous because it
> neglects all the good parts of io_uring that _can't_ be used. I don't
> wanna derail the
> conversation with all those details but I can expand upon this if required.

Did you look into whether or not you can do that with asio,
by reducing the asio::io_context to just wait for events? And then
initiating all the rest manually. That'd work for async.

>
> > If you want to use your own event loop, you can write an executor for it, too.
>
> I see. Is this as a replacement for the one used internally by Async?

Async needs an executor to use for dispatch & post. Atm the type
defaults to any_io_executor (which is a type erased wrapper).

If you want to change the type we should figure out a solution, it's
possible from my end.
I.e. the config.hpp defines an executor type alias that gets used everywhere,
which could be changed to something else. I just don't know how to
handle includes in the config in a way acceptable for boost.

>
> > Most likely UB. The await_suspend(std::coroutine_handle<T> h)
> > can however grab the executor from the promise,
> > by calling h.promise().get_executor() (after checking with a requires
> > statement) if you need to post back.
>
> Why would this be UB?

Because you'll run thread unsafe code on two threads then. It *shuold*
be fine if you got a single coroutine stack,
but once you select(coro1, coro2) and both resume on different threads
you'll have UB.


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