Files
cppdraft_translate/cppdraft/exec/sched.md
2025-10-25 03:02:53 +03:00

4.2 KiB

[exec.sched]

33 Execution control library [exec]

33.6 Schedulers [exec.sched]

1

#

The scheduler concept defines the requirements of a scheduler type ([exec.async.ops]).

schedule is a customization point object that accepts a scheduler.

A valid invocation of schedule is a schedule-expression.

namespace std::execution {templateconcept scheduler =derived_from<typename remove_cvref_t::scheduler_concept, scheduler_t> &&queryable &&requires(Sch&& sch) {{ schedule(std::forward(sch)) } -> sender; { auto(get_completion_scheduler<set_value_t>( get_env(schedule(std::forward(sch))))) }-> same_as<remove_cvref_t>; } &&equality_comparable<remove_cvref_t> &&copyable<remove_cvref_t>;}

2

#

Let Sch be the type of a scheduler and let Env be the type of an execution environment for which sender_in<schedule_result_t, Env> is satisfied.

Then sender-in-of<schedule_result_t, Env> shall be modeled.

3

#

No operation required bycopyable<remove_cvref_t> andequality_comparable<remove_cvref_t> shall exit via an exception.

None of these operations, nor a scheduler type's schedule function, shall introduce data races as a result of potentially concurrent ([intro.races]) invocations of those operations from different threads.

4

#

For any two values sch1 and sch2 of some scheduler type Sch,sch1 == sch2 shall return true only if both sch1 and sch2 share the same associated execution resource.

5

#

For a given scheduler expression sch, the expressionget_completion_scheduler<set_value_t>(get_env(schedule(sch))) shall compare equal to sch.

6

#

For a given scheduler expression sch, if the expression get_domain(sch) is well-formed, then the expression get_domain(get_env(schedule(sch))) is also well-formed and has the same type.

7

#

A scheduler type's destructor shall not block pending completion of any receivers connected to the sender objects returned from schedule.

[Note 1:

The ability to wait for completion of submitted function objects can be provided by the associated execution resource of the scheduler.

— end note]