C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Automatic Coroutine Cancellation

From: Rhidian De Wit <rhidiandewit_at_[hidden]>
Date: Mon, 20 Apr 2026 17:07:57 +0200
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-20 15:08:09