boost::capy::await_context

Carries the executor, stop token, and frame allocator through a coroutine chain.

Synopsis

struct await_context;

Description

This struct bundles the execution context passed through coroutine chains via the ContextAwaitable protocol. It contains the executor for resumption, a stop token for cancellation, and an optional frame allocator for coroutine frame allocation.

Lifetime

Launcher functions (run_async, run) own the await_context and guarantee it outlives all tasks and awaitables in the started chain. Awaitables receive await_context const* in await_suspend and should store it directly, never copy the pointed‐to object.

Thread Safety

The referenced executor and allocator must remain valid for the lifetime of any coroutine using this environment.

Data Members

Name

Description

executor

The executor for coroutine resumption.

frame_allocator

The frame allocator for coroutine frame allocation.

owner

The owner of the chain segment running in this environment.

stop_token

The stop token for cancellation propagation.

See Also