This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

103
cppdraft/exec/general.md Normal file
View File

@@ -0,0 +1,103 @@
[exec.general]
# 33 Execution control library [[exec]](./#exec)
## 33.1 General [exec.general]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L6)
This Clause describes components
supporting execution of function objects ([[function.objects]](function.objects "22.10Function objects"))[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L10)
The following subclauses describe
the requirements, concepts, and components
for execution control primitives as summarized in Table [157](#tab:exec.summary "Table 157: Execution control library summary")[.](#2.sentence-1)
Table [157](#tab:exec.summary) — Execution control library summary [[tab:exec.summary]](./tab:exec.summary)
| [🔗](#tab:exec.summary-row-1) | **Subclause** | **Header** |
| --- | --- | --- |
| [🔗](#tab:exec.summary-row-2)<br>[[exec.sched]](exec.sched "33.6Schedulers") | Schedulers | <execution> |
| [🔗](#tab:exec.summary-row-3)<br>[[exec.recv]](exec.recv "33.7Receivers") | Receivers | |
| [🔗](#tab:exec.summary-row-4)<br>[[exec.opstate]](exec.opstate "33.8Operation states") | Operation states | |
| [🔗](#tab:exec.summary-row-5)<br>[[exec.snd]](exec.snd "33.9Senders") | Senders | |
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L22)
Table [158](#tab:exec.pos "Table 158: Types of customization point objects in the execution control library") shows
the types of customization point objects ([[customization.point.object]](customization.point.object "16.3.3.3.5Customization Point Object types"))
used in the execution control library[.](#3.sentence-1)
Table [158](#tab:exec.pos) — Types of customization point objects in the execution control library [[tab:exec.pos]](./tab:exec.pos)
| [🔗](#tab:exec.pos-row-1)<br>**Customization point** | **Purpose** | **Examples** |
| --- | --- | --- |
| [🔗](#tab:exec.pos-row-2)<br>**object type** | | |
| [🔗](#tab:exec.pos-row-3)<br>core | provide core execution functionality, and connection between core components | e.g., [connect](execution.syn#lib:connect "33.4Header <execution> synopsis[execution.syn]"), [start](execution.syn#lib:start "33.4Header <execution> synopsis[execution.syn]") |
| [🔗](#tab:exec.pos-row-4)<br>completion functions | called by senders to announce the completion of the work (success, error, or cancellation) | [set_value](execution.syn#lib:set_value "33.4Header <execution> synopsis[execution.syn]"), [set_error](execution.syn#lib:set_error "33.4Header <execution> synopsis[execution.syn]"), [set_stopped](execution.syn#lib:set_stopped "33.4Header <execution> synopsis[execution.syn]") |
| [🔗](#tab:exec.pos-row-5)<br>senders | allow the specialization of the provided sender algorithms | sender factories (e.g., [schedule](execution.syn#lib:schedule "33.4Header <execution> synopsis[execution.syn]"), [just](execution.syn#lib:just "33.4Header <execution> synopsis[execution.syn]"), [read_env](execution.syn#lib:read_env "33.4Header <execution> synopsis[execution.syn]"))sender adaptors (e.g., [continues_on](execution.syn#lib:continues_on "33.4Header <execution> synopsis[execution.syn]"), [then](execution.syn#lib:then "33.4Header <execution> synopsis[execution.syn]"), [let_value](execution.syn#lib:let_value "33.4Header <execution> synopsis[execution.syn]"))sender consumers (e.g., [sync_wait](execution.syn#lib:sync_wait "33.4Header <execution> synopsis[execution.syn]")) |
| [🔗](#tab:exec.pos-row-6)<br>queries | allow querying different properties of objects | general queries (e.g., [get_allocator](execution.syn#lib:get_allocator "33.4Header <execution> synopsis[execution.syn]"), [get_stop_token](execution.syn#lib:get_stop_token "33.4Header <execution> synopsis[execution.syn]"))environment queries (e.g., get_scheduler, [get_delegation_scheduler](execution.syn#lib:get_delegation_scheduler "33.4Header <execution> synopsis[execution.syn]"))scheduler queries (e.g., [get_forward_progress_guarantee](execution.syn#lib:get_forward_progress_guarantee "33.4Header <execution> synopsis[execution.syn]"))sender attribute queries (e.g., [get_completion_scheduler](execution.syn#lib:get_completion_scheduler "33.4Header <execution> synopsis[execution.syn]")) |
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L57)
This clause makes use of the following exposition-only entities[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L60)
For a subexpression expr,
let *MANDATE-NOTHROW*(expr) be
expression-equivalent to expr[.](#5.sentence-1)
*Mandates*: noexcept(expr) is true[.](#5.sentence-2)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L68)
namespace std {template<class T>concept [*movable-value*](#concept:movable-value "33.1General[exec.general]") = // *exposition only*[move_constructible](concept.moveconstructible#concept:move_constructible "18.4.13Concept move_­constructible[concept.moveconstructible]")<decay_t<T>> &&[constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<decay_t<T>, T> &&(!is_array_v<remove_reference_t<T>>);}
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L79)
For function types F1 and F2 denotingR1(Args1...) and R2(Args2...), respectively,*MATCHING-SIG*(F1, F2) is true if and only if[same_as](concept.same#concept:same_as "18.4.2Concept same_­as[concept.same]")<R1(Args1&&...), R2(Args2&&...)> is true[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L86)
For a subexpression err,
let Err be decltype((err)) and
let *AS-EXCEPT-PTR*(err) be:
- [(8.1)](#8.1)
err if decay_t<Err> denotes the type exception_ptr[.](#8.1.sentence-1)
*Preconditions*: !err is false[.](#8.1.sentence-2)
- [(8.2)](#8.2)
Otherwise,make_exception_ptr(system_error(err)) if decay_t<Err> denotes the type error_code[.](#8.2.sentence-1)
- [(8.3)](#8.3)
Otherwise, make_exception_ptr(err)[.](#8.3.sentence-1)
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L104)
For a subexpression expr,
let *AS-CONST*(expr) be expression-equivalent to[](const auto& x) noexcept -> const auto& { return x; }(expr)