From Jason Turner

[exec.task.scheduler]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpjgdpgoto/{from.md → to.md} +139 -0
tmp/tmpjgdpgoto/{from.md → to.md} RENAMED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### `execution::task_scheduler` <a id="exec.task.scheduler">[[exec.task.scheduler]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::execution {
5
+ class task_scheduler {
6
+ class ts-sender; // exposition only
7
+
8
+ template<receiver R>
9
+ class state; // exposition only
10
+
11
+ public:
12
+ using scheduler_concept = scheduler_t;
13
+
14
+ template<class Sch, class Allocator = allocator<void>>
15
+ requires (!same_as<task_scheduler, remove_cvref_t<Sch>>)
16
+ && scheduler<Sch>
17
+ explicit task_scheduler(Sch&& sch, Allocator alloc = {});
18
+
19
+ ts-sender schedule();
20
+
21
+ friend bool operator==(const task_scheduler& lhs, const task_scheduler& rhs)
22
+ noexcept;
23
+ template<class Sch>
24
+ requires (!same_as<task_scheduler, Sch>)
25
+ && scheduler<Sch>
26
+ friend bool operator==(const task_scheduler& lhs, const Sch& rhs) noexcept;
27
+
28
+ private:
29
+ shared_ptr<void> sch_; // exposition only
30
+ };
31
+ }
32
+ ```
33
+
34
+ `task_scheduler` is a class that models `scheduler` [[exec.sched]].
35
+ Given an object `s` of type `task_scheduler`, let `SCHED(s)` be the
36
+ object owned by `s.sch_`.
37
+
38
+ ``` cpp
39
+ template<class Sch, class Allocator = allocator<void>>
40
+ requires(!same_as<task_scheduler, remove_cvref_t<Sch>>) && scheduler<Sch>
41
+ explicit task_scheduler(Sch&& sch, Allocator alloc = {});
42
+ ```
43
+
44
+ *Effects:* Initialize *sch\_* with
45
+ `allocate_shared<remove_cvref_t<Sch>>(alloc, std::forward<Sch>(sch))`.
46
+
47
+ *Recommended practice:* Implementations should avoid the use of
48
+ dynamically allocated memory for small scheduler objects.
49
+
50
+ *Remarks:* Any allocations performed by construction of *ts-sender* or
51
+ *state* objects resulting from calls on `*this` are performed using a
52
+ copy of `alloc`.
53
+
54
+ ``` cpp
55
+ ts-sender schedule();
56
+ ```
57
+
58
+ *Effects:* Returns an object of type *ts-sender* containing a sender
59
+ initialized with `schedule(`*`SCHED`*`(*this))`.
60
+
61
+ ``` cpp
62
+ bool operator==(const task_scheduler& lhs, const task_scheduler& rhs) noexcept;
63
+ ```
64
+
65
+ *Effects:* Equivalent to: `return lhs == `*`SCHED`*`(rhs);`
66
+
67
+ ``` cpp
68
+ template<class Sch>
69
+ requires (!same_as<task_scheduler, Sch>)
70
+ && scheduler<Sch>
71
+ bool operator==(const task_scheduler& lhs, const Sch& rhs) noexcept;
72
+ ```
73
+
74
+ *Returns:* `false` if the type of *`SCHED`*`(lhs)` is not `Sch`,
75
+ otherwise *`SCHED`*`(lhs) == rhs`.
76
+
77
+ ``` cpp
78
+ namespace std::execution {
79
+ class task_scheduler::ts-sender { // exposition only
80
+ public:
81
+ using sender_concept = sender_t;
82
+
83
+ template<receiver Rcvr>
84
+ state<Rcvr> connect(Rcvr&& rcvr);
85
+ };
86
+ }
87
+ ```
88
+
89
+ *`ts-sender`* is an exposition-only class that models `sender`
90
+ [[exec.snd]] and for which `completion_signatures_of_t<ts-sender>`
91
+ denotes:
92
+
93
+ ``` cpp
94
+ completion_signatures<
95
+ set_value_t(),
96
+ set_error_t(error_code),
97
+ set_error_t(exception_ptr),
98
+ set_stopped_t()>
99
+ ```
100
+
101
+ Let `sch` be an object of type `task_scheduler` and let `sndr` be an
102
+ object of type *`ts-sender`* obtained from `schedule(sch)`. Then
103
+ `get_completion_scheduler<set_value_t>(get_env(sndr)) == sch` is `true`.
104
+ The object `SENDER(sndr)` is the sender object contained by `sndr` or an
105
+ object move constructed from it.
106
+
107
+ ``` cpp
108
+ template<receiver Rcvr>
109
+ state<Rcvr> connect(Rcvr&& rcvr);
110
+ ```
111
+
112
+ *Effects:* Let *`r`* be an object of a type that models `receiver` and
113
+ whose completion handlers result in invoking the corresponding
114
+ completion handlers of `rcvr` or copy thereof. Returns an object of type
115
+ *`state`*`<Rcvr>` containing an operation state object initialized with
116
+ `connect(`*`SENDER`*`(*this), std::move(`*`r`*`))`.
117
+
118
+ ``` cpp
119
+ namespace std::execution {
120
+ template<receiver R>
121
+ class task_scheduler::state { // exposition only
122
+ public:
123
+ using operation_state_concept = operation_state_t;
124
+
125
+ void start() & noexcept;
126
+ };
127
+ }
128
+ ```
129
+
130
+ *`state`* is an exposition-only class template whose specializations
131
+ model `operation_state` [[exec.opstate]].
132
+
133
+ ``` cpp
134
+ void start() & noexcept;
135
+ ```
136
+
137
+ *Effects:* Equivalent to `start(st)` where `st` is the operation state
138
+ object contained by `*this`.
139
+