Init
This commit is contained in:
56
cppdraft/exec/recv/concepts.md
Normal file
56
cppdraft/exec/recv/concepts.md
Normal file
@@ -0,0 +1,56 @@
|
||||
[exec.recv.concepts]
|
||||
|
||||
# 33 Execution control library [[exec]](./#exec)
|
||||
|
||||
## 33.7 Receivers [[exec.recv]](exec.recv#concepts)
|
||||
|
||||
### 33.7.1 Receiver concepts [exec.recv.concepts]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L1173)
|
||||
|
||||
A receiver represents the continuation of an asynchronous operation[.](#1.sentence-1)
|
||||
|
||||
The [receiver](#concept:receiver "33.7.1 Receiver concepts [exec.recv.concepts]") concept defines
|
||||
the requirements for a receiver type ([[exec.async.ops]](exec.async.ops "33.3 Asynchronous operations"))[.](#1.sentence-2)
|
||||
|
||||
The [receiver_of](#concept:receiver_of "33.7.1 Receiver concepts [exec.recv.concepts]") concept defines
|
||||
the requirements for a receiver type that is usable as
|
||||
the first argument of a set of completion operations
|
||||
corresponding to a set of completion signatures[.](#1.sentence-3)
|
||||
|
||||
The get_env customization point object is used to access
|
||||
a receiver's associated environment[.](#1.sentence-4)
|
||||
|
||||
namespace std::execution {template<class Rcvr>concept [receiver](#concept:receiver "33.7.1 Receiver concepts [exec.recv.concepts]") =[derived_from](concept.derived#concept:derived_from "18.4.3 Concept derived_from [concept.derived]")<typename remove_cvref_t<Rcvr>::receiver_concept, receiver_t> &&requires(const remove_cvref_t<Rcvr>& rcvr) {{ get_env(rcvr) } -> [*queryable*](exec.queryable.concept#concept:queryable "33.2.2 queryable concept [exec.queryable.concept]"); } &&[move_constructible](concept.moveconstructible#concept:move_constructible "18.4.13 Concept move_constructible [concept.moveconstructible]")<remove_cvref_t<Rcvr>> && // rvalues are movable, and[constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_from [concept.constructible]")<remove_cvref_t<Rcvr>, Rcvr>; // lvalues are copyabletemplate<class Signature, class Rcvr>concept [*valid-completion-for*](#concept:valid-completion-for "33.7.1 Receiver concepts [exec.recv.concepts]") = // *exposition only*requires (Signature* sig) {[]<class Tag, class... Args>(Tag(*)(Args...))requires [*callable*](functional.syn#concept:callable "22.10.2 Header <functional> synopsis [functional.syn]")<Tag, remove_cvref_t<Rcvr>, Args...>{}(sig); }; template<class Rcvr, class Completions>concept [*has-completions*](#concept:has-completions "33.7.1 Receiver concepts [exec.recv.concepts]") = // *exposition only*requires (Completions* completions) {[]<[*valid-completion-for*](#concept:valid-completion-for "33.7.1 Receiver concepts [exec.recv.concepts]")<Rcvr>...Sigs>(completion_signatures<Sigs...>*){}(completions); }; template<class Rcvr, class Completions>concept [receiver_of](#concept:receiver_of "33.7.1 Receiver concepts [exec.recv.concepts]") =[receiver](#concept:receiver "33.7.1 Receiver concepts [exec.recv.concepts]")<Rcvr> && [*has-completions*](#concept:has-completions "33.7.1 Receiver concepts [exec.recv.concepts]")<Rcvr, Completions>;}
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L1215)
|
||||
|
||||
Class types that are marked final do not model the [receiver](#concept:receiver "33.7.1 Receiver concepts [exec.recv.concepts]") concept[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L1218)
|
||||
|
||||
Let rcvr be a receiver and
|
||||
let op_state be an operation state associated with
|
||||
an asynchronous operation created by connecting rcvr with a sender[.](#3.sentence-1)
|
||||
|
||||
Let token be a stop token equal toget_stop_token(get_env(rcvr))[.](#3.sentence-2)
|
||||
|
||||
token shall remain valid
|
||||
for the duration of the asynchronous operation's lifetime ([[exec.async.ops]](exec.async.ops "33.3 Asynchronous operations"))[.](#3.sentence-3)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
This means that, unless it knows about further guarantees
|
||||
provided by the type of rcvr,
|
||||
the implementation of op_state cannot use token after it executes a completion operation[.](#3.sentence-4)
|
||||
|
||||
This also implies that any stop callbacks registered on token
|
||||
must be destroyed before the invocation of the completion operation[.](#3.sentence-5)
|
||||
|
||||
â *end note*]
|
||||
Reference in New Issue
Block a user