tmp/tmpb_hrn4r3/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Exposition-only `execution::stop-when` <a id="exec.stop.when">[[exec.stop.when]]</a>
|
| 2 |
+
|
| 3 |
+
*`stop-when`* fuses an additional stop token `t` into a sender so that,
|
| 4 |
+
upon connecting to a receiver `r`, the resulting operation state
|
| 5 |
+
receives stop requests from both `t` and the token returned from
|
| 6 |
+
`get_stop_token(get_env(r))`.
|
| 7 |
+
|
| 8 |
+
The name *`stop-when`* denotes an exposition-only sender adaptor. For
|
| 9 |
+
subexpressions `sndr` and `token`:
|
| 10 |
+
|
| 11 |
+
- If `decltype((sndr))` does not satisfy `sender`, or
|
| 12 |
+
`remove_cvref_t<decltype((token))>` does not satisfy
|
| 13 |
+
`stoppable_token`, then `stop-when(sndr, token)` is ill-formed.
|
| 14 |
+
- Otherwise, if `remove_cvref_t<decltype((token))>` models
|
| 15 |
+
`unstoppable_token` then `stop-when({}sndr, token)` is
|
| 16 |
+
expression-equivalent to `sndr`.
|
| 17 |
+
- Otherwise, `stop-when(sndr, token)` returns a sender `osndr`. If
|
| 18 |
+
`osndr` is connected to a receiver `r`, let `rtoken` be the result of
|
| 19 |
+
`get_stop_token(get_env(r))`.
|
| 20 |
+
- If the type of `rtoken` models `unstoppable_token` then the effects
|
| 21 |
+
of connecting `osndr` to `r` are equivalent to
|
| 22 |
+
`connect(write_env(sndr, prop(get_stop_token, token)), r)`.
|
| 23 |
+
- Otherwise, the effects of connecting `osndr` to `r` are equivalent
|
| 24 |
+
to `connect(write_env(sndr, prop(get_stop_token, stoken)), r)` where
|
| 25 |
+
`stoken` is an object of an exposition-only type *`stoken-t`* such
|
| 26 |
+
that:
|
| 27 |
+
- *`stoken-t`* models `stoppable_token`;
|
| 28 |
+
- `stoken.stop_requested()` returns
|
| 29 |
+
`token.stop_requested() || rtoken.stop_reques-{}ted()`;
|
| 30 |
+
- `stoken.stop_possible()` returns
|
| 31 |
+
`token.stop_possible() || rtoken.stop_possible()`; and
|
| 32 |
+
- for types `Fn` and `Init` such that both `invocable<Fn>` and
|
| 33 |
+
`constructible_from<Fn, Init>` are modeled,
|
| 34 |
+
`stoken-t::callback_type<Fn>` models
|
| 35 |
+
`stoppable-callback-for<Fn, stoken-t, Init>`.\begin{tailnote}
|
| 36 |
+
For an object \texttt{fn} of type \texttt{Fn}
|
| 37 |
+
constructed from a value, \texttt{init}, of type \texttt{Init},
|
| 38 |
+
registering \texttt{fn} using
|
| 39 |
+
\texttt{\exposid{stoken-t}::callback_type\<Fn\>(stoken, init)}
|
| 40 |
+
results in an invocation of \texttt{fn} when
|
| 41 |
+
a callback registered with \texttt{token} or \texttt{rtoken} would be invoked.
|
| 42 |
+
\texttt{fn} is invoked at most once.
|
| 43 |
+
\end{tailnote}
|
| 44 |
+
|