From Jason Turner

[exec.recv]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpxe7o0_6d/{from.md → to.md} +83 -0
tmp/tmpxe7o0_6d/{from.md → to.md} RENAMED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Receivers <a id="exec.recv">[[exec.recv]]</a>
2
+
3
+ ### Receiver concepts <a id="exec.recv.concepts">[[exec.recv.concepts]]</a>
4
+
5
+ A receiver represents the continuation of an asynchronous operation. The
6
+ `receiver` concept defines the requirements for a receiver type
7
+ [[exec.async.ops]]. The `receiver_of` concept defines the requirements
8
+ for a receiver type that is usable as the first argument of a set of
9
+ completion operations corresponding to a set of completion signatures.
10
+ The `get_env` customization point object is used to access a receiver’s
11
+ associated environment.
12
+
13
+ ``` cpp
14
+ namespace std::execution {
15
+ template<class Rcvr>
16
+ concept receiver =
17
+ derived_from<typename remove_cvref_t<Rcvr>::receiver_concept, receiver_t> &&
18
+ requires(const remove_cvref_t<Rcvr>& rcvr) {
19
+ { get_env(rcvr) } -> queryable;
20
+ } &&
21
+ move_constructible<remove_cvref_t<Rcvr>> && // rvalues are movable, and
22
+ constructible_from<remove_cvref_t<Rcvr>, Rcvr>; // lvalues are copyable
23
+
24
+ template<class Signature, class Rcvr>
25
+ concept valid-completion-for = // exposition only
26
+ requires (Signature* sig) {
27
+ []<class Tag, class... Args>(Tag(*)(Args...))
28
+ requires callable<Tag, remove_cvref_t<Rcvr>, Args...>
29
+ {}(sig);
30
+ };
31
+
32
+ template<class Rcvr, class Completions>
33
+ concept has-completions = // exposition only
34
+ requires (Completions* completions) {
35
+ []<valid-completion-for<Rcvr>...Sigs>(completion_signatures<Sigs...>*)
36
+ {}(completions);
37
+ };
38
+
39
+ template<class Rcvr, class Completions>
40
+ concept receiver_of =
41
+ receiver<Rcvr> && has-completions<Rcvr, Completions>;
42
+ }
43
+ ```
44
+
45
+ Class types that are marked `final` do not model the `receiver` concept.
46
+
47
+ Let `rcvr` be a receiver and let `op_state` be an operation state
48
+ associated with an asynchronous operation created by connecting `rcvr`
49
+ with a sender. Let `token` be a stop token equal to
50
+ `get_stop_token(get_env(rcvr))`. `token` shall remain valid for the
51
+ duration of the asynchronous operation’s lifetime [[exec.async.ops]].
52
+
53
+ [*Note 1*: This means that, unless it knows about further guarantees
54
+ provided by the type of `rcvr`, the implementation of `op_state` cannot
55
+ use `token` after it executes a completion operation. This also implies
56
+ that any stop callbacks registered on token must be destroyed before the
57
+ invocation of the completion operation. — *end note*]
58
+
59
+ ### `execution::set_value` <a id="exec.set.value">[[exec.set.value]]</a>
60
+
61
+ `set_value` is a value completion function [[exec.async.ops]]. Its
62
+ associated completion tag is `set_value_t`. The expression
63
+ `set_value(rcvr, vs...)` for a subexpression `rcvr` and pack of
64
+ subexpressions `vs` is ill-formed if `rcvr` is an lvalue or an rvalue of
65
+ const type. Otherwise, it is expression-equivalent to
66
+ `MANDATE-NOTHROW(rcvr.set_value(vs...))`.
67
+
68
+ ### `execution::set_error` <a id="exec.set.error">[[exec.set.error]]</a>
69
+
70
+ `set_error` is an error completion function [[exec.async.ops]]. Its
71
+ associated completion tag is `set_error_t`. The expression
72
+ `set_error(rcvr, err)` for some subexpressions `rcvr` and `err` is
73
+ ill-formed if `rcvr` is an lvalue or an rvalue of const type. Otherwise,
74
+ it is expression-equivalent to `MANDATE-NOTHROW(rcvr.set_error(err))`.
75
+
76
+ ### `execution::set_stopped` <a id="exec.set.stopped">[[exec.set.stopped]]</a>
77
+
78
+ `set_stopped` is a stopped completion function [[exec.async.ops]]. Its
79
+ associated completion tag is `set_stopped_t`. The expression
80
+ `set_stopped(rcvr)` for a subexpression `rcvr` is ill-formed if `rcvr`
81
+ is an lvalue or an rvalue of const type. Otherwise, it is
82
+ expression-equivalent to `MANDATE-NOTHROW(rcvr.set_stopped())`.
83
+