From Jason Turner

[exec.run.loop.types]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpskmzinme/{from.md → to.md} +81 -0
tmp/tmpskmzinme/{from.md → to.md} RENAMED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Associated types <a id="exec.run.loop.types">[[exec.run.loop.types]]</a>
2
+
3
+ ``` cpp
4
+ class run-loop-scheduler;
5
+ ```
6
+
7
+ *`run-loop-scheduler`* is an unspecified type that models `scheduler`.
8
+
9
+ Instances of *`run-loop-scheduler`* remain valid until the end of the
10
+ lifetime of the `run_loop` instance from which they were obtained.
11
+
12
+ Two instances of *`run-loop-scheduler`* compare equal if and only if
13
+ they were obtained from the same `run_loop` instance.
14
+
15
+ Let *`sch`* be an expression of type *`run-loop-scheduler`*. The
16
+ expression `schedule(sch)` has type *`run-loop- sender`* and is not
17
+ potentially-throwing if *`sch`* is not potentially-throwing.
18
+
19
+ ``` cpp
20
+ class run-loop-sender;
21
+ ```
22
+
23
+ *`run-loop-sender`* is an exposition-only type that satisfies `sender`.
24
+ `completion_signatures_of_t<run-{loop-sender}>` is
25
+
26
+ ``` cpp
27
+ completion_signatures<set_value_t(), set_error_t(exception_ptr), set_stopped_t()>
28
+ ```
29
+
30
+ An instance of *`run-loop-sender`* remains valid until the end of the
31
+ lifetime of its associated `run_loop` instance.
32
+
33
+ Let *`sndr`* be an expression of type *`run-loop-sender`*, let *`rcvr`*
34
+ be an expression such that `receiver_of<decltype((rcvr)), CS>` is `true`
35
+ where `CS` is the `completion_signatures` specialization above. Let `C`
36
+ be either `set_value_t` or `set_stopped_t`. Then:
37
+
38
+ - The expression `connect(sndr, rcvr)` has type
39
+ `run-loop-opstate<decay_t<decltype((rcvr))>>` and is
40
+ potentially-throwing if and only if `(void(sndr), auto(rcvr))` is
41
+ potentially-throwing.
42
+ - The expression `get_completion_scheduler<C>(get_env(sndr))` is
43
+ potentially-throwing if and only if *`sndr`* is potentially-throwing,
44
+ has type *`run-loop-scheduler`*, and compares equal to the
45
+ *`run-loop- scheduler`* instance from which *`sndr`* was obtained.
46
+
47
+ ``` cpp
48
+ template<class Rcvr>
49
+ struct run-loop-opstate;
50
+ ```
51
+
52
+ `\exposid{run-loop-opstate}<Rcvr>`
53
+
54
+ inherits privately and unambiguously from *`run-loop-opstate-base`*.
55
+
56
+ Let o be a non-const lvalue of type `run-loop-opstate<Rcvr>`, and let
57
+ `REC(o)` be a non-const lvalue reference to an instance of type `Rcvr`
58
+ that was initialized with the expression *`rcvr`* passed to the
59
+ invocation of connect that returned o. Then:
60
+
61
+ - The object to which `REC(o)` refers remains valid for the lifetime of
62
+ the object to which o refers.
63
+ - The type `run-loop-opstate<Rcvr>` overrides
64
+ `run-loop-opstate-base::execute()` such that `o.execute()` is
65
+ equivalent to:
66
+ ``` cpp
67
+ if (get_stop_token(REC(o)).stop_requested()) {
68
+ set_stopped(std::move(REC(o)));
69
+ } else {
70
+ set_value(std::move(REC(o)));
71
+ }
72
+ ```
73
+ - The expression `start(o)` is equivalent to:
74
+ ``` cpp
75
+ try {
76
+ o.loop->push-back(addressof(o));
77
+ } catch(...) {
78
+ set_error(std::move(REC(o)), current_exception());
79
+ }
80
+ ```
81
+