diff --git a/execution.bs b/execution.bs index 3515da1..cca5487 100644 --- a/execution.bs +++ b/execution.bs @@ -2419,9 +2419,9 @@ first proposed in [[P2175R0]]. At a high-level, the facilities proposed by this paper for supporting cancellation include: -* Add `std::stoppable_token` and `std::stoppable_token_for` concepts that - generalise the interface of `std::stop_token` type to allow other types with - different implementation strategies. +* Add a `std::stoppable_token` concept that generalises the interface of the + `std::stop_token` type to allow other stop token types with different + implementation strategies. * Add `std::unstoppable_token` concept for detecting whether a `stoppable_token` can never receive a stop-request. * Add `std::inplace_stop_token`, `std::inplace_stop_source` and @@ -4120,21 +4120,20 @@ namespace std { typically because the result is no longer required. Such a request is called a stop request. -2. stoppable_source, - stoppable_token, and - stoppable_callback_for - implementare concepts that specify the required syntax - and semantics of shared ownershipaccess of a - stop state. Any - stoppable_source, - stoppable_token, or - stoppable_callback_for object that - shares ownership ofrefers to the same stop state is an - associated stoppable_source, - stoppable_token, or - stoppable_callback_for, respectively. - The last remaining owner of the stop state automatically releases the - resources associated with the stop state. +2. `stop_source`, `stop_token`, and `stop_callback` implement + `stoppable-source`, `stoppable_token`, and + `stoppable-callback-for` are concepts that specify the required + syntax and semantics of shared ownershipaccess + of a stop state. Any `stop_source`, + `stop_token`, or `stop_callback` object that shares ownership of the same + stop state is an **associated** `stop_source`, `stop_token`, or + `stop_callback`, respectively. Any object modeling + `stoppable-source`, `stoppable_token`, or + `stoppable-callback-for` that refers to the same stop state is an + associated `stoppable-source`, + `stoppable_token`, or `stoppable-callback-for`, + respectively. The last remaining owner of the stop state + automatically releases the resources associated with the stop state. 3. A stoppable_token can be passed to an operation whichthat can either @@ -4147,28 +4146,27 @@ namespace std { template whichthat will be called in the event that a stop request is made. - A stop request made via a stoppable_source will be - visible to all associated stoppable_token and - stoppable_source objects. Once a stop request has - been made it cannot be withdrawn (a subsequent stop request has no effect). + A stop request made via a `stop_source`an object that models + `stoppable-source` will be visible to all associated + stoppable_token and `stop_source` + `stoppable-source` objects. Once a stop request has been + made it cannot be withdrawn (a subsequent stop request has no effect). -4. Callbacks registered via a - stoppable_callback_for object are called - when a stop request is first made by any associated - stoppable_source object. +4. Callbacks registered via a `stop_callback` objectan object + that models `stoppable-callback-for` are called when a stop + request is first made by any associated `stop_source` + `stoppable-source` object. The following paragraph is moved to the specification of -the new `stoppable_source` concept. +the new `stoppable-source` concept.
5. Calls to the functions `request_stop`, `stop_requested`, and `stop_possible` do not introduce data races. A call to `request_stop` that returns `true` - synchronizes with a call to `stop_requested` on an associated - stoppable_token or - stoppable_source object that returns `true`. - Registration of a callback synchronizes with the invocation of that - callback. + synchronizes with a call to `stop_requested` on an associated `stop_token` + or `stop_source` object that returns `true`. Registration of a callback + synchronizes with the invocation of that callback.
@@ -4195,7 +4193,7 @@ declarations into the `` synopsis: namespace std {
// [stoptoken.concepts], stop token concepts template<class Callback, class Token, class Initializer = Callback> - concept stoppable_callback_for = see below; + concept stoppable-callback-for = see below; // exposition only template<class Token> concept stoppable_token = see below; @@ -4204,7 +4202,7 @@ namespace std { concept unstoppable_token = see below; template<class Source> - concept stoppable_source = see below;
+ concept stoppable-source = see below; // exposition only // 33.3.3, class stop_token class stop_token; @@ -4253,12 +4251,12 @@ Header `` synopsis [thread.stoptoken.syn] and Class arguments, if the type `stop_callback_for_t` is valid, it denotes the type of a stop callback to use to register a callback to be executed if a stop request is ever made on the `stoppable_token`'s - associated stop source. The `stoppable_callback_for` concept checks for a - callback compatible with a given stop token type. + associated stop source. The exposition-only `stoppable-callback-for` + concept checks for a callback compatible with a given stop token type.
     template<class Callback, class Token, class Initializer = Callback>
-      concept stoppable_callback_for =
+      concept stoppable-callback-for = // exposition only
         invocable<Callback> &&
         constructible_from<Callback, Initializer> &&
         requires { typename stop_callback_for_t<Token, Callback>; } &&
@@ -4270,8 +4268,8 @@ Header `` synopsis [thread.stoptoken.syn] and Class
     `Initializer`; and let `CB` denote the type `stop_callback_for_t`.
 
-3. The concept `stoppable_callback_for` is modeled
-    only if:
+3. The concept stoppable-callback-for<Callback, Token,
+    Initializer> is modeled only if:
 
     1. The following concepts are modeled:
 
@@ -4390,27 +4388,29 @@ Header `` synopsis [thread.stoptoken.syn] and Class
         after `E` shall evaluate to `true`.
 
     3. For any types `Callback` and `Initializer`, if
-        `stoppable_callback_for` is satisfied,
-        then `stoppable_callback_for` shall be
-        modeled.
-
-    4. A `stoppable_token` object has at most one associated logical stop state.
-        A `stoppable_token` object with no associated stop state is said to be
-        disengaged. For a disengaged `stoppable_token`
-        object, `stop_possible` and `stop_requested` shall return `false`. If
-        `t` and `u` reference the same stop state, or if both `t` and `u` are
-        disengaged, `t == u` shall be `true`; otherwise, it shall be `false`.
-
-6. A model of `stoppable_source` can be queried whether stop has been requested
-    (`stop_requested`) and whether stop is possible (`stop_possible`). It is a
-    factory for associated stop tokens (`get_token`) and can be explicitly
-    placed into the "stop requested" state (`request_stop`). It maintains a list
-    of registered stop callback invocations that it executes when a stop request
-    is first made.
+        stoppable-callback-for<Callback, Token,
+        Initializer> is satisfied, then
+        stoppable-callback-for<Callback, Token,
+        Initializer> shall be modeled.
+
+    4. An object that models `stoppable_token` has at most one associated
+        logical stop state. A `stoppable_token` object with no associated stop
+        state is said to be disengaged. For a disengaged
+        `stoppable_token` object, `stop_possible` and `stop_requested` shall
+        return `false`. If `t` and `u` reference the same stop state, or if both
+        `t` and `u` are disengaged, `t == u` shall be `true`; otherwise, it
+        shall be `false`.
+
+6. A model of the exposition-only `stoppable-source` concept can be
+    queried whether stop has been requested (`stop_requested`) and whether stop
+    is possible (`stop_possible`). It is a factory for associated stop tokens
+    (`get_token`) and can be explicitly placed into the "stop requested" state
+    (`request_stop`). It maintains a list of registered stop callback
+    invocations that it executes when a stop request is first made.
 
     
     template<class Source>
-      concept stoppable_source =
+      concept stoppable-source = // exposition only
         requires (Source& src, const Source csrc) { // see implicit expression variations
                                                     // ([concepts.equality])
           { csrc.get_token() } -> stoppable_token;
@@ -4420,14 +4420,15 @@ Header `` synopsis [thread.stoptoken.syn] and Class
         };
     
- 1. A `stoppable_source` object has at most one associated logical stop - state. A `stoppable_source` object with no associated stop state is said - to be disengaged. For a disengaged `stoppable_source` object, - `stop_possible` and `stop_requested` shall return `false`. + 1. A `stoppable-source` object has at most one associated logical + stop state. A `stoppable-source` object with no associated stop + state is said to be disengaged. For a disengaged + `stoppable-source` object, `stop_possible` and `stop_requested` + shall return `false`. - 2. A disengaged `stoppable_source` object shall return a disengaged stop token - from `get_token()`. Otherwise, `get_token()` shall return a stop token that - is associated with the stop state of the source. + 2. A disengaged `stoppable-source` object shall return a disengaged + stop token from `get_token()`. Otherwise, `get_token()` shall return a + stop token that is associated with the stop state of the source. The following paragraph is moved from the introduction, with minor modifications (underlined in green). @@ -4437,16 +4438,15 @@ Header `` synopsis [thread.stoptoken.syn] and Class functions on associated `stoppable_token` objects do not introduce data races. A call to `request_stop` that returns `true` synchronizes with a call to `stop_requested` on an associated - stoppable_token or - stoppable_source object that returns `true`. - Registration of a callback synchronizes with the invocation of that - callback. + stoppable_token or `stop_source` + `stoppable-source` object that returns `true`. Registration + of a callback synchronizes with the invocation of that callback. The following paragraph is taken from [[#spec-stopsource.mem]] and modified. - 4. If the `stoppable_source` is disengaged, `request_stop` shall have no - effect and return `false`. Otherwise, it shall execute a `stoppable-source` is disengaged, `request_stop` shall have + no effect and return `false`. Otherwise, it shall execute a stop request operation on the associated stop state. A stop request operation determines whether the stop state has received a stop request, and if not, makes a stop request. The determination and @@ -4638,7 +4638,7 @@ friend void swap(stop_token& x, stop_token& y) noexcept; request. A stop request made on a `stop_source` object is visible to all associated `stop_source` and `stop_token` ([thread.stoptoken]) objects. Once a stop request has been made it cannot be withdrawn (a subsequent stop - request has no effect)models `stoppable_source`. + request has no effect)models `stoppable-source`.
 namespace std {
@@ -4881,10 +4881,12 @@ namespace std {
 
 
-3. *Remarks:* For a type `C`, if `stoppable_callback_for` is satisfied, then `stoppable_callback_for` is - modeled. The exposition-only `callback` member is the associated callback - function ([stoptoken.concepts]) of `stop_callback` objects. +3. *Remarks:* For a type `C`, if + stoppable-callback-for<Callback, stop_token, C> is + satisfied, then stoppable-callback-for<Callback, stop_token, + C> is modeled. The exposition-only `callback` member is the + associated callback function ([stoptoken.concepts]) of + `stop_callback` objects.
@@ -5056,7 +5058,7 @@ of Stop tokens [thread.stoptoken]. #### General [stopsource.inplace.general] #### {#spec-stopsource.inplace.general} -1. The class `inplace_stop_source` models `stoppable_source`. Unlike +1. The class `inplace_stop_source` models `stoppable-source`. Unlike `stop_source`, `inplace_stop_source` does not require dynamic allocation or reference counting of a shared stop state. Instead, it requires that all uses of associated `inplace_stop_token` and `inplace_stop_callback` @@ -5164,11 +5166,13 @@ added above, as a new subclause of Stop tokens [thread.stoptoken]. template parameter `Callback` that satisfies both `invocable` and `destructible`. -2. *Remarks:* For a type `C`, if `stoppable_callback_for` is satisfied, then `stoppable_callback_for` is modeled. The exposition-only - `stop-callback` member is the associated callback function - ([stoptoken.concepts]) of `inplace_stop_callback` objects. +2. *Remarks:* For a type `C`, if + stoppable-callback-for<Callback, inplace_stop_token, + C> is satisfied, then + stoppable-callback-for<Callback, inplace_stop_token, + C> is modeled. The exposition-only `stop-callback` member is + the associated callback function ([stoptoken.concepts]) of + `inplace_stop_callback` objects. Implementations are not permitted to use additional storage, such as dynamic memory, to store the state necessary for an @@ -6533,30 +6537,27 @@ namespace std::execution { template<class Sndr, class Rcvr, class Index> requires well-formed<env-type, Index, Sndr, Rcvr> struct basic-receiver { // exposition only - using tag-type = tag_of_t<Sndr>; // exposition only using receiver_concept = receiver_t; + using tag-type = tag_of_t<Sndr>; // exposition only + using state-type = state-type<Sndr, Rcvr>; // exposition only + static constexpr const auto& complete = impls-for<tag-type>::complete; // exposition only + template<class... Args> - requires cpo-callable<impls-for<tag-type>::complete, - Index, state-type<Sndr, Rcvr>&, Rcvr&, set_value_t, Args...> + requires cpo-callable<complete, Index, state-type&, Rcvr&, set_value_t, Args...> void set_value(Args&&... args) && noexcept { - (void) impls-for<tag-type>::complete( - Index(), op->state, op->rcvr, set_value_t(), std::forward<Args>(args)...); + complete(Index(), op->state, op->rcvr, set_value_t(), std::forward<Args>(args)...); } template<class Error> - requires cpo-callable<impls-for<tag-type>::complete, - Index, state-type<Sndr, Rcvr>&, Rcvr&, set_error_t, Error> + requires cpo-callable<complete, Index, state-type&, Rcvr&, set_error_t, Error> void set_error(Error&& err) && noexcept { - (void) impls-for<tag-type>::complete( - Index(), op->state, op->rcvr, set_error_t(), std::forward<Error>(err)); + complete(Index(), op->state, op->rcvr, set_error_t(), std::forward<Error>(err)); } void set_stopped() && noexcept - requires cpo-callable<impls-for<tag-type>::complete, - Index, state-type<Sndr, Rcvr>&, Rcvr&, set_stopped_t> { - (void) impls-for<tag-type>::complete( - Index(), op->state, op->rcvr, set_stopped_t()); + requires cpo-callable<complete, Index, state-type&, Rcvr&, set_stopped_t> { + complete(Index(), op->state, op->rcvr, set_stopped_t()); } auto get_env() const noexcept -> env-type<Index, Sndr, Rcvr> {