C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Automatic Coroutine Cancellation

From: Zhao YunShan <dou1984_at_[hidden]>
Date: Tue, 21 Apr 2026 09:41:48 +0800 (CST)
Do any compilers support std::execution::task yet?



At 2026-04-20 23:07:57, "Rhidian De Wit" <rhidiandewit_at_[hidden]> wrote:

Sorry for the long delay, been quite busy as of late.


The `std::execution::task` seems like exactly what I was hoping for, thanks a lot for bringing it to my attention! It wasn't on cppreference when I was looking through the std::execution page.


We can kill this thread here then, reading the proposal it seems to support the cancellation I was hoping to see.


Op di 14 apr 2026 om 15:59 schreef Ville Voutilainen <ville.voutilainen_at_[hidden]>:

On Tue, 14 Apr 2026 at 16:44, Rhidian De Wit <rhidiandewit_at_[hidden]> wrote:
>
> I saw indeed that they had this built-in and rely on the `as_awaitable` function to become coroutines (not a huge fan of this API design, but I digress), but I couldn't find anything on the promise_type it returns. How will this is `as_awaitable` work? What will it return?
> If it returns a standard-provided promise_type then we can happily discard this thread.

Iit returns a result that you use with co_await in a coroutine whose
result is a std::execution::task.

You can also make your own promise types sender-aware by using
std::execution::with_awaitable_senders.





--
Rhidian De Wit
Software Engineer - Barco

Received on 2026-04-21 01:41:54