boost::capy::resume_context

Unified context serving as both dispatcher and scheduler.

Synopsis

Declared in <boost/capy/affine.hpp>

template<typename Scheduler>
class resume_context;

Description

This class wraps a scheduler and provides a unified interface that works with both P2300 senders and traditional awaitables. It acts as a dispatcher (callable with coroutine handles) while also providing access to the underlying scheduler for sender operations like continues_on.

Dispatcher Interface

The class satisfies the dispatcher concept:

resume_context<MyScheduler> ctx{scheduler};
ctx(h);  // Dispatches coroutine handle via scheduler

Scheduler Access

For P2300 sender operations:

auto sender = continues_on(some_sender, ctx.scheduler());

Scheduler Requirements

The scheduler type must provide a dispatch method:

struct Scheduler
{
    template<typename F>
    void dispatch(F&& f);
};

Member Functions

Name

Description

resume_context [constructor]

Construct from a scheduler reference.

operator=

Copy assignment operator

operator()

Dispatch a continuation via the scheduler.

scheduler

Access the underlying scheduler.

operator==

Equality operator

Template Parameters

Name Description

Scheduler

The underlying scheduler type.

Created with MrDocs