Hello, After digging deeper in corosio's code base from the following link: https://github.com/cppalliance/corosio/blob/0cb2c0096ca2cf8f7c1f1617cb04c191... You were spot-on with my suggestions, keeping the Executor concept as is would indeed be beneficial per P4007 [2] (Sender and Co-routines, https://wg21.link/p4007) Thanks, Amlal. On 2/20/26 15:11, Vinnie Falco via Boost wrote:
On Fri, Feb 20, 2026 at 4:32 AM Amlal El Mahrouss via Boost < boost@lists.boost.org> wrote:
I also have a question about the following snippet at: https://github.com/cppalliance/capy/blob/develop/example/asio/use_capy_examp...
We can see at line 119:
```cpp capy::run_async(ctx.get_executor())(run_example(client, server)); ```
It's elegant, but maybe we could also benefit from this syntax as well:
```cpp auto& exec{ctx.get_executor()}; exec.run_async(run_example(client, server)); ```
So, if I understand you correctly then you are asking for the Executor concept to have additional members:
unspecified run_async( IoRunnable auto&& );
This is problematic for a few reasons explained P4003[1]
1. An Executor is a low-level primitive. It only specifies how a coroutine is resumed. A launch function is something different: a high level construct responsible for creating the environment in which a coroutine runs, and specifying behavior when the coroutine performs its final suspend. run_async falls in the latter category.
2. The one-call syntax you propose suffers from the allocator timing problem described in P4007 Senders and Coroutines [2]. The coroutine frame would be created before the allocator has the chance to propagate.
3. `run_async` is just one example of a launch function: a function which begins a new coroutine chain of execution either from a regular function (such as main) or a coroutine. The set of launch functions is open, as users can (and will) define their own. Here is one such example:
https://github.com/cppalliance/corosio/blob/0cb2c0096ca2cf8f7c1f1617cb04c191...
It makes sense to keep the Executor concept as a low-level narrow abstraction, and partition the launch functions into a higher level algorithmic set.
Thanks
[1] https://wg21.link/p4003 IoAwaitables: A Coroutines-Only Framework
[2] https://wg21.link/p4007 Senders and Coroutines
P.S. I suppose its pointless asking for the copyright discussion to be moved to a separate thread :) _______________________________________________ Boost mailing list -- boost@lists.boost.org To unsubscribe send an email to boost-leave@lists.boost.org https://lists.boost.org/mailman3/lists/boost.lists.boost.org/ Archived at: https://lists.boost.org/archives/list/boost@lists.boost.org/message/XP6QFNJJ...