From Jason Turner

[exec.sync.wait.var]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp9044mov6/{from.md → to.md} +46 -0
tmp/tmp9044mov6/{from.md → to.md} RENAMED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### `this_thread::sync_wait_with_variant` <a id="exec.sync.wait.var">[[exec.sync.wait.var]]</a>
2
+
3
+ The name `this_thread::sync_wait_with_variant` denotes a customization
4
+ point object. For a subexpression `sndr`, let `Sndr` be
5
+ `decltype(into_variant(sndr))`. The expression
6
+ `this_thread::sync_wait_with_variant(sndr)` is expression-equivalent to
7
+ the following, except `sndr` is evaluated only once:
8
+
9
+ ``` cpp
10
+ apply_sender(get-domain-early(sndr), sync_wait_with_variant, sndr)
11
+ ```
12
+
13
+ *Mandates:*
14
+
15
+ - `sender_in<Sndr, sync-wait-env>` is `true`.
16
+ - The type `sync-wait-with-variant-result-type<Sndr>` is well-formed.
17
+ - `same_as<decltype(e), sync-wait-with-variant-result-type<Sndr>>` is
18
+ `true`, where e is the `apply_sender` expression above.
19
+
20
+ The expression `sync_wait_with_variant.apply_sender(sndr)` is equivalent
21
+ to:
22
+
23
+ ``` cpp
24
+ using result_type = sync-wait-with-variant-result-type<Sndr>;
25
+ if (auto opt_value = sync_wait(into_variant(sndr))) {
26
+ return result_type(std::move(get<0>(*opt_value)));
27
+ }
28
+ return result_type(nullopt);
29
+ ```
30
+
31
+ The behavior of `this_thread::sync_wait_with_variant(sndr)` is undefined
32
+ unless:
33
+
34
+ - It blocks the current thread of execution [[defns.block]] with forward
35
+ progress guarantee delegation [[intro.progress]] until the specified
36
+ sender completes. \[*Note 1*: The default implementation of
37
+ `sync_wait_with_variant` achieves forward progress guarantee
38
+ delegation by relying on the forward progress guarantee delegation
39
+ provided by `sync_wait`. — *end note*]
40
+ - It returns the specified sender’s async results as follows:
41
+ - For a value completion, the result datums are returned in an engaged
42
+ `optional` object that contains a `variant` of `tuple`s.
43
+ - For an error completion, an exception is thrown.
44
+ - For a stopped completion, a disengaged `optional` object is
45
+ returned.
46
+