[exec.with.awaitable.senders]

# 33 Execution control library [[exec]](./#exec)

## 33.13 Coroutine utilities [[exec.coro.util]](exec.coro.util#exec.with.awaitable.senders)

### 33.13.2 execution​::​with_awaitable_senders [exec.with.awaitable.senders]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L6793)

with_awaitable_senders,
when used as the base class of a coroutine promise type,
makes senders awaitable in that coroutine type[.](#1.sentence-1)

In addition, it provides a default implementation of unhandled_stopped such that if a sender completes by calling set_stopped,
it is treated as if an uncatchable "stopped" exception were thrown
from the [*await-expression*](expr.await#nt:await-expression "7.6.2.4 Await [expr.await]")[.](#1.sentence-2)

[*Note [1](#note-1)*:

The coroutine is never resumed, and
the unhandled_stopped of the coroutine caller's promise type is called[.](#1.sentence-3)

â *end note*]

namespace std::execution {template<[*class-type*](execution.syn#concept:class-type "33.4 Header <execution> synopsis [execution.syn]") Promise>struct [with_awaitable_senders](#lib:with_awaitable_senders "33.13.2 execution​::​with_­awaitable_­senders [exec.with.awaitable.senders]") {template<class OtherPromise>requires (![same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<OtherPromise, void>)void set_continuation(coroutine_handle<OtherPromise> h) noexcept;

 coroutine_handle<> [continuation](#lib:with_awaitable_senders,continuation "33.13.2 execution​::​with_­awaitable_­senders [exec.with.awaitable.senders]")() const noexcept { return *continuation*; } coroutine_handle<> [unhandled_stopped](#lib:with_awaitable_senders,unhandled_stopped "33.13.2 execution​::​with_­awaitable_­senders [exec.with.awaitable.senders]")() noexcept {return *stopped-handler*(*continuation*.address()); }template<class Value>*see below* await_transform(Value&& value); private:[[noreturn]] static coroutine_handle<>*default-unhandled-stopped*(void*) noexcept { // *exposition only* terminate(); } coroutine_handle<> *continuation*{}; // *exposition only* coroutine_handle<> (**stopped-handler*)(void*) noexcept = // *exposition only*&*default-unhandled-stopped*; };}

[ð](#lib:set_continuation,with_awaitable_senders)

`template<class OtherPromise>
  requires (![same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<OtherPromise, void>)
void set_continuation(coroutine_handle<OtherPromise> h) noexcept;
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L6844)

*Effects*: Equivalent to:*continuation* = h;if constexpr ( requires(OtherPromise& other) { other.unhandled_stopped(); } ) {*stopped-handler* = [](void* p) noexcept -> coroutine_handle<> {return coroutine_handle<OtherPromise>::from_address(p).promise().unhandled_stopped(); };} else {*stopped-handler* = &*default-unhandled-stopped*;}

[ð](#lib:await_transform,with_awaitable_senders)

`template<class Value>
call-result-t<as_awaitable_t, Value, Promise&> await_transform(Value&& value);
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L6867)

*Effects*: Equivalent to:return as_awaitable(std::forward<Value>(value), static_cast<Promise&>(*this));
