[exec.run.loop.types] (original) (raw)
33 Execution control library [exec]
33.12 Execution contexts [exec.ctx]
33.12.1 execution::run_loop [exec.run.loop]
33.12.1.2 Associated types [exec.run.loop.types]
class _run-loop-scheduler_;
run-loop-scheduler is an unspecified type that models scheduler.
Instances of run-loop-scheduler remain valid until the end of the lifetime of the run_loop instance from which they were obtained.
Two instances of run-loop-scheduler compare equal if and only if they were obtained from the same run_loop instance.
Let sch be an expression of type run-loop-scheduler.
The expression schedule(sch)has type run-loop- sender and is not potentially-throwing if sch is not potentially-throwing.
run-loop-sender is an exposition-only type that satisfies sender.
For any type Env,completion_signatures_of_t<_run-loop-sender_, Env> iscompletion_signatures<set_value_t(), set_error_t(exception_ptr), set_stopped_t()>
An instance of run-loop-sender remains valid until the end of the lifetime of its associated run_loop instance.
Let sndr be an expression of type run-loop-sender, let rcvr be an expression such that receiver_of<decltype((_rcvr_)), CS> is truewhere CS is the completion_signatures specialization above.
Let C be either set_value_t or set_stopped_t.
Then:
- The expression connect(sndr, rcvr)has type run-loop-opstate<decay_t<decltype((_rcvr_))>>and is potentially-throwing if and only if(void(sndr), auto(rcvr)) is potentially-throwing.
- The expression get_completion_scheduler<C>(get_env(sndr))is potentially-throwing if and only if sndr is potentially-throwing, has type run-loop-scheduler, and compares equal to the run-loop-
scheduler instance from which sndr was obtained.
template<class Rcvr> struct _run-loop-opstate_;
run-loop-opstate<Rcvr>inherits privately and unambiguously from run-loop-opstate-base.
Let o be a non-const lvalue of type run-loop-opstate<Rcvr>, and let REC(o) be a non-const lvalue reference to an instance of type Rcvrthat was initialized with the expression _rcvr_passed to the invocation of connect that returned o.
Then:
- The object to which REC(o) refers remains valid for the lifetime of the object to which o refers.
- The type run-loop-opstate<Rcvr> overrides_run-loop-opstate-base_::execute()such that o.execute() is equivalent to:if (get_stop_token(REC(o)).stop_requested()) { set_stopped(std::move(REC(o)));} else { set_value(std::move(REC(o)));}
- The expression start(o) is equivalent to:try { o._loop_->push-back(addressof(o));} catch(...) { set_error(std::move(REC(o)), current_exception());}