Re: [Capy review] Some questions

Klemens Morgenstern via Boost <[email protected]> Wed, 24 Jun 2026 00:21:59 +0800
Newsgroups gmane.comp.lib.boost.devel
Message-ID <CAGT5OKPCFy3B3MtTBHPu1K5MpSDOgzbOr9a17tmym8SMffbeLA@mail.gmail.com>
On Wed, Jun 24, 2026 at 12:05 AM Ruben Perez via Boost <
[email protected]> wrote:

> Hi all,
>
> As you might know, I'm currently using Capy and Corosio in 3 projects:
>
> * Boost.Redis [1]: I've implemented a Corosio API matching what we had for
> Asio. Currently in a PR that will be merged if the libraries are accepted.
> * A fork of Boost.MySQL [2]. It is functional, but unclear if I will
> propose it as a new library, or add it to the existing one.
> * A PostgreSQL library that I'm writing [3].
>
> I'm in general happy. Coroutines make everything much simpler. I don't have
> this "everything wants to eat me" feeling that writing Asio universal async
> operations transmits. Benchmarks are also quite promising, well above what
> we were able to get with Asio. Marcelo did the benchmarks, so I'll leave
> him to tell the whole story here.
>
> I've got some real questions that need answers before emitting a review.
>
> 1) What's the status of the interoperability with Asio, and what can we
> expect? Asio currently has many users who won't migrate their existing code
> from one day to another.
>
> There is a pull request in Capy [4] addressing this. I'd like to know what
> to expect. Especially, how seamless would the interaction with Corosio
> (rather than Capy) be? Would the following work?
>
> // Code using capy/corosio that creates I/O objects
> capy::task<> my_capy_task()
> {
>     corosio::tcp_socket sock {co_await capy::this_coro::executor};
>     co_await sock.connect(/* whatever */);
> }
>
> // Represents the main application, still using Asio.
> // At some point, it needs to call out to code using capy/corosio
> asio::awaitable<void> co_main()
> {
>     auto exec = capy::wrap_asio_executor(co_await
> asio::this_coro::executor);
>     co_await capy::asio_spawn(my_capy_task(), compute());
> }
>
> int main()
> {
>     asio::io_context ctx;
>     asio::co_spawn(ctx, co_main(), asio::detached);
>     ctx.run();
> }
>
>
I am not sure what `compute()` is in this example, but generally yes.

You can also wrap asio's stream so they are a capy::Stream and vice versa.

You can find the docs for the PR here:
https://246.capy.prtest3.cppalliance.org/capy/4.coroutines/4i.asio-integration.html

I was hoping we could get this merged by the review, but the review
announcement snuck up on me, so it didn't get finished in time.
_______________________________________________
Boost mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.boost.org/mailman3/lists/boost.lists.boost.org/
Archived at: https://lists.boost.org/archives/list/[email protected]/message/7ITFRIHHM7YWQCHX6J2TGXG35FJKCKA6/