@@ -4278,69 +4278,67 @@ Header `<stop_token>` synopsis <b>[thread.stoptoken.syn]</b> and Class
4278
4278
4279
4279
2. An object of type `SCB` has an associated <dfn export=true>callback
4280
4280
function</dfn> of type `CallbackFn`. Let `scb` be an object of type `SCB`
4281
- and let `cbfn ` denote `scb`'s associated callback function.
4281
+ and let `callback_fn ` denote `scb`'s associated callback function.
4282
4282
Direct-non-list-initializing `scb` from arguments `t` and `init` shall
4283
4283
execute a <dfn export=true>stoppable callback registration</dfn> as
4284
4284
follows:
4285
4285
4286
4286
1. If `t.stop_possible()` is `true`:
4287
4287
4288
- 1. `cbfn ` shall be direct-initialized with `init`.
4288
+ 1. `callback_fn ` shall be direct-initialized with `init`.
4289
4289
4290
4290
2. Construction of `scb` shall only throw exceptions thrown by the
4291
- initialization of `cbfn ` from `init`.
4291
+ initialization of `callback_fn ` from `init`.
4292
4292
4293
- 3. The callback invocation
4294
- <code> std::forward<CallbackFn>(cbfn)()</code> shall
4295
- be registered with `t`'s associated stop state as follows:
4293
+ 3. The callback invocation `std::forward<CallbackFn>(callback_fn)()`
4294
+ shall be registered with `t`'s associated stop state as follows:
4296
4295
4297
4296
1. If `t.stop_requested()` evaluates to `false` at the time of
4298
4297
registration, the callback invocation is added to the stop
4299
4298
state's list of callbacks such that
4300
- <code> std::forward< CallbackFn>(cbfn )()</code> is
4301
- evaluated if a stop request is made on the stop state.
4299
+ ` std::forward< CallbackFn>(callback_fn )()` is evaluated if a
4300
+ stop request is made on the stop state.
4302
4301
4303
- 2. Otherwise,
4304
- <code> std::forward<CallbackFn>(cbfn)()</code>
4305
- shall be immediately evaluated on the thread executing
4306
- `scb`'s constructor, and the callback invocation shall not be
4307
- added to the list of callback invocations.
4302
+ 2. Otherwise, `std::forward<CallbackFn>(callback_fn)()` shall be
4303
+ immediately evaluated on the thread executing `scb`'s
4304
+ constructor, and the callback invocation shall not be added
4305
+ to the list of callback invocations.
4308
4306
4309
4307
4. If the callback invocation was added to stop state's list of
4310
4308
callbacks, `scb` shall be associated with the stop state.
4311
4309
4312
4310
2. <span class="wg21note"> If `t.stop_possible()` is `false`, there is no
4313
4311
requirement that the initialization of `scb` causes the
4314
- initialization of `cbfn `.</span>
4312
+ initialization of `callback_fn `.</span>
4315
4313
4316
4314
3. Destruction of `scb` shall execute a <dfn export=true>stoppable callback
4317
4315
deregistration</dfn> as follows (in order):
4318
4316
4319
4317
1. If the constructor of `scb` did not register a callback invocation
4320
4318
with `t`'s stop state, then the stoppable callback
4321
- deregistration shall have no effect other than destroying `cbfn `
4319
+ deregistration shall have no effect other than destroying `callback_fn `
4322
4320
if it was constructed.
4323
4321
4324
- 2. Otherwise, the invocation of `cbfn ` shall be removed from
4322
+ 2. Otherwise, the invocation of `callback_fn ` shall be removed from
4325
4323
the associated stop state.
4326
4324
4327
- 3. If `cbfn ` is concurrently executing on another thread
4325
+ 3. If `callback_fn ` is concurrently executing on another thread
4328
4326
then the stoppable callback deregistration shall block
4329
- ([defns.block] ) until the invocation of `cbfn ` returns
4330
- such that the return from the invocation of `cbfn `
4327
+ ([defns.block] ) until the invocation of `callback_fn ` returns
4328
+ such that the return from the invocation of `callback_fn `
4331
4329
strongly happens before ([intro.races] ) the destruction of
4332
- `cbfn `.
4330
+ `callback_fn `.
4333
4331
4334
- 4. If `cbfn ` is executing on the current thread, then the
4332
+ 4. If `callback_fn ` is executing on the current thread, then the
4335
4333
destructor shall not block waiting for the return from the
4336
- invocation of `cbfn `.
4334
+ invocation of `callback_fn `.
4337
4335
4338
4336
5. A stoppable callback deregistration shall not block on the completion
4339
4337
of the invocation of some other callback registered with the same
4340
4338
logical stop state.
4341
4339
4342
4340
6. The stoppable callback deregistration shall destroy
4343
- `cbfn `.
4341
+ `callback_fn `.
4344
4342
4345
4343
4. The `stoppable_token` concept checks for the basic interface of a stop token
4346
4344
that is copyable and allows polling to see if stop has been requested and
@@ -4399,8 +4397,6 @@ Header `<stop_token>` synopsis <b>[thread.stoptoken.syn]</b> and Class
4399
4397
5. If `t` and `u` reference the same stop state, or if both `t` and `u` are
4400
4398
disengaged, `t == u` is `true`; otherwise, it is `false`.
4401
4399
4402
- <!-- LWG stopped here on 2024-04-17 -->
4403
-
4404
4400
8. An object whose type models the exposition-only <i> `stoppable-source`</i>
4405
4401
concept can be queried whether stop has been requested (`stop_requested`)
4406
4402
and whether stop is possible (`stop_possible`). It is a factory for
@@ -4420,15 +4416,15 @@ Header `<stop_token>` synopsis <b>[thread.stoptoken.syn]</b> and Class
4420
4416
};
4421
4417
</pre>
4422
4418
4423
- 1. A <i> `stoppable-source`</i> object has at most one associated logical
4424
- stop state. A <i> `stoppable-source` </i> object with no associated stop
4425
- state is said to be disengaged. For a disengaged
4426
- <i> `stoppable-source`</i> object, `stop_possible` and `stop_requested `
4427
- shall return `false`.
4419
+ 1. An object whose type models <i> `stoppable-source`</i> has at most one
4420
+ associated logical stop state. If it has no associated stop state, it is
4421
+ said to be disengaged. Let `s` be an object whose type models
4422
+ <i> `stoppable-source`</i> and that is disengaged. `s.stop_possible() `
4423
+ and `s.stop_requested()` shall return `false`.
4428
4424
4429
- 2. A disengaged <i> `stoppable-source`</i> object shall return a disengaged
4430
- stop token from `get_token()`. Otherwise , `get_token()` shall return a
4431
- stop token that is associated with the stop state of the source .
4425
+ 2. Let `t` be an object whose type models <i> `stoppable-source`</i> . If `t` is
4426
+ disengaged , `t. get_token()` shall return a disengaged stop token; otherwise,
4427
+ it shall return a stop token that is associated with the stop state of `t` .
4432
4428
4433
4429
<span class="ed-note"> The following paragraph is moved from the introduction,
4434
4430
with minor modifications (underlined in green).</span>
@@ -4519,7 +4515,7 @@ namespace std {
4519
4515
<div class="ins">
4520
4516
4521
4517
1. <i> `stop-state`</i> refers to the `stop_token`'s associated stop state. A
4522
- `stop_token` object is disengaged when <i> `stop-state`</i> is null .</div>
4518
+ `stop_token` object is disengaged when <i> `stop-state`</i> is empty .</div>
4523
4519
4524
4520
</div>
4525
4521
@@ -4582,7 +4578,7 @@ void swap(stop_token& rhs) noexcept;
4582
4578
</pre>
4583
4579
4584
4580
1. *Effects:* <del> Exchanges the values of `*this` and `rhs`.</del> <ins> Equivalent to:
4585
- <code> std::swap( <i> stop-state</i> , rhs.<i> stop-state</i> )</code> .</ins>
4581
+ <code><i> stop-state</i> .swap( rhs.<i> stop-state</i> )</code> .</ins>
4586
4582
4587
4583
<pre highlight="c++">
4588
4584
<del> [[nodiscard]] </del> bool stop_requested() const noexcept;
@@ -4634,11 +4630,11 @@ friend void swap(stop_token& x, stop_token& y) noexcept;
4634
4630
4635
4631
#### General <b> [stopsource.general] </b> #### {#spec-stopsource.general}
4636
4632
4637
- 1. The class `stop_source` <del> implements the semantics of making a stop
4633
+ 1. <del> The class `stop_source` implements the semantics of making a stop
4638
4634
request. A stop request made on a `stop_source` object is visible to all
4639
4635
associated `stop_source` and `stop_token` ([thread.stoptoken] ) objects. Once
4640
4636
a stop request has been made it cannot be withdrawn (a subsequent stop
4641
- request has no effect)</del><ins> models <i> `stoppable-source` </i></ins> .
4637
+ request has no effect). </del>
4642
4638
4643
4639
<pre highlight="c++">
4644
4640
namespace std {
@@ -4682,9 +4678,10 @@ namespace std {
4682
4678
4683
4679
<div class="ins">
4684
4680
1. <i> `stop-state`</i> refers to the `stop_source`'s associated stop state. A
4685
- `stop_source` object is disengaged when <i> `stop-state`</i> is null .
4681
+ `stop_source` object is disengaged when <i> `stop-state`</i> is empty .
4686
4682
4687
- 2. `stop_source` models `copyable`, `equality_comparable`, and `swappable`.
4683
+ 2. `stop_source` models <i> `stoppable-source`</i> , `copyable`,
4684
+ `equality_comparable`, and `swappable`.
4688
4685
4689
4686
</div>
4690
4687
@@ -4755,29 +4752,29 @@ stop_source& operator=(stop_source&& rhs) noexcept;
4755
4752
void swap(stop_source& rhs) noexcept;
4756
4753
</pre>
4757
4754
4758
- 12 . *Effects:* <del> Exchanges the values of `*this` and `rhs`</del><ins> Equivalent to:
4759
- <code> std::swap( <i> stop-state</i> , rhs.<i> stop-state</i> )</code></ins> .
4755
+ 1 . *Effects:* <del> Exchanges the values of `*this` and `rhs`</del><ins> Equivalent to:
4756
+ <code><i> stop-state</i> .swap( rhs.<i> stop-state</i> )</code></ins> .
4760
4757
4761
4758
<pre highlight="c++">
4762
4759
<del> [[nodiscard]] </del> stop_token get_token() const noexcept;
4763
4760
</pre>
4764
4761
4765
- 1 . *Returns:* `stop_token()` if `stop_possible()` is `false`; otherwise a new
4766
- associated `stop_token` object<ins> ; *i.e.*, its <i> `stop-state`</i> pointer
4767
- is equal to the <i> `stop-state`</i> pointer of `*this`</ins> .
4762
+ 2 . *Returns:* `stop_token()` if `stop_possible()` is `false`; otherwise a new
4763
+ associated `stop_token` object<ins> ; *i.e.*, its <i> `stop-state`</i> member
4764
+ is equal to the <i> `stop-state`</i> member of `*this`</ins> .
4768
4765
4769
4766
<pre highlight="c++">
4770
4767
<del> [[nodiscard]] </del> bool stop_possible() const noexcept;
4771
4768
</pre>
4772
4769
4773
- 2 . *Returns:* <del> `true` if `*this` has ownership of a stop state; otherwise,
4770
+ 3 . *Returns:* <del> `true` if `*this` has ownership of a stop state; otherwise,
4774
4771
`false`</del><ins><code><i> stop-state</i> != nullptr</code></ins> .
4775
4772
4776
4773
<pre highlight="c++">
4777
4774
<del> [[nodiscard]] </del> bool stop_requested() const noexcept;
4778
4775
</pre>
4779
4776
4780
- 3 . *Returns:* `true` if <del> `*this` has ownership
4777
+ 4 . *Returns:* `true` if <del> `*this` has ownership
4781
4778
of</del><ins><i> `stop-state`</i> refers to</ins> a stop state that has
4782
4779
received a stop request; otherwise, `false`.
4783
4780
@@ -4786,7 +4783,7 @@ bool request_stop() noexcept;
4786
4783
</pre>
4787
4784
4788
4785
<div class="ins">
4789
- 4 . *Effects:* Executes a stop request operation ([stoptoken.concepts] ) on the
4786
+ 5 . *Effects:* Executes a stop request operation ([stoptoken.concepts] ) on the
4790
4787
associated stop state, if any.
4791
4788
4792
4789
</div>
@@ -4847,12 +4844,12 @@ namespace std {
4847
4844
using callback_type = Callback<ins> Fn</ins> ;
4848
4845
4849
4846
// 33.3.5.2, constructors and destructor
4850
- template<class C < ins>BF </ins> >
4851
- explicit stop_callback(const stop_token& st, C < ins>BF </ins> && cb<ins> fn </ins> )
4852
- noexcept(is_nothrow_constructible_v<Callback<ins> Fn</ins> , C < ins>BF </ins> >);
4853
- template<class C < ins>BF </ins> >
4854
- explicit stop_callback(stop_token&& st, C < ins>BF </ins> && cb<ins> fn </ins> )
4855
- noexcept(is_nothrow_constructible_v<Callback<ins> Fn</ins> , C < ins>BF </ins> >);
4847
+ template<class <del> C </del>< ins>Initializer </ins> >
4848
+ explicit stop_callback(const stop_token& st, <del> C </del>< ins>Initializer </ins> && <del> cb</del>< ins> init </ins> )
4849
+ noexcept(is_nothrow_constructible_v<Callback<ins> Fn</ins> , <del> C </del>< ins>Initializer </ins> >);
4850
+ template<class <del> C </del>< ins>Initializer </ins> >
4851
+ explicit stop_callback(stop_token&& st, <del> C </del>< ins>Initializer </ins> && <del> cb</del>< ins> init </ins> )
4852
+ noexcept(is_nothrow_constructible_v<Callback<ins> Fn</ins> , <del> C </del>< ins>Initializer </ins> >);
4856
4853
~stop_callback();
4857
4854
4858
4855
stop_callback(const stop_callback&) = delete;
@@ -4882,10 +4879,10 @@ namespace std {
4882
4879
4883
4880
<div class="ins">
4884
4881
4885
- 3. *Remarks:* For a type <code> CBF </code> , if
4886
- <code><i> stoppable-callback-for</i> <CallbackFn, stop_token, CBF ></code> is
4882
+ 3. *Remarks:* For a type <code> Initializer </code> , if
4883
+ <code><i> stoppable-callback-for</i> <CallbackFn, stop_token, Initializer ></code> is
4887
4884
satisfied, then <code><i> stoppable-callback-for</i> <CallbackFn, stop_token,
4888
- CBF ></code> is modeled. The exposition-only <i> `callback-fn`</i> member is the
4885
+ Initializer ></code> is modeled. The exposition-only <i> `callback-fn`</i> member is the
4889
4886
associated callback function ([stoptoken.concepts] ) of
4890
4887
`stop_callback<CallbackFn>` objects.
4891
4888
@@ -4894,16 +4891,16 @@ namespace std {
4894
4891
#### Constructors and destructor <b> [stopcallback.cons] </b> #### {#spec-stopcallback.cons}
4895
4892
4896
4893
<pre highlight="c++">
4897
- template<class C < ins>BF </ins> >
4898
- explicit stop_callback(const stop_token& st, C < ins>BF </ins> && cb<ins> fn </ins> )
4899
- noexcept(is_nothrow_constructible_v<Callback<ins> Fn</ins> , C < ins>BF </ins> >);
4900
- template<class C < ins>BF </ins> >
4901
- explicit stop_callback(stop_token&& st, C < ins>BF </ins> && cb<ins> fn </ins> )
4902
- noexcept(is_nothrow_constructible_v<Callback<ins> Fn</ins> , C < ins>BF </ins> >);
4894
+ template<class <del> C </del>< ins>Initializer </ins> >
4895
+ explicit stop_callback(const stop_token& st, <del> C </del>< ins>Initializer </ins> && <del> cb</del>< ins> init </ins> )
4896
+ noexcept(is_nothrow_constructible_v<Callback<ins> Fn</ins> , <del> C </del>< ins>Initializer </ins> >);
4897
+ template<class <del> C </del>< ins>Initializer </ins> >
4898
+ explicit stop_callback(stop_token&& st, <del> C </del>< ins>Initializer </ins> && <del> cb</del>< ins> init </ins> )
4899
+ noexcept(is_nothrow_constructible_v<Callback<ins> Fn</ins> , <del> C </del>< ins>Initializer </ins> >);
4903
4900
</pre>
4904
4901
4905
- 1. *Constraints:* <code> Callback<ins> Fn</ins></code> and <code> C < ins>BF </ins></code> satisfy
4906
- <code> constructible_from<Callback<ins> Fn</ins> , C < ins>BF </ins> ></code> .
4902
+ 1. *Constraints:* <code> Callback<ins> Fn</ins></code> and <code><del> C </del>< ins>Initializer </ins></code> satisfy
4903
+ <code> constructible_from<Callback<ins> Fn</ins> , <del> C </del>< ins>Initializer </ins> ></code> .
4907
4904
4908
4905
<div class="del">
4909
4906
2. *Preconditions:* `Callback` and `C` model `constructible_from<Callback, C>`.
@@ -4912,7 +4909,7 @@ explicit stop_callback(stop_token&& st, C<ins>BF</ins>&& cb<ins>fn</ins>)
4912
4909
4913
4910
3. *Effects:* Initializes
4914
4911
<code><del> callback</del><ins><i> callback-fn</i></ins></code> with
4915
- <code> std::forward<C < ins>BF </ins> >(cb<ins> fn </ins> )</code> <ins> and
4912
+ <code> std::forward<<del> C </del>< ins>Initializer </ins> >(<del> cb</del>< ins> init </ins> )</code> <ins> and
4916
4913
executes a stoppable callback registration
4917
4914
([stoptoken.concepts] )</ins> . <del> If `st.stop_requested()` is `true`, then
4918
4915
`std::forward<Callback>(callback)()` is evaluated in the current thread
@@ -4944,12 +4941,13 @@ explicit stop_callback(stop_token&& st, C<ins>BF</ins>&& cb<ins>fn</ins>)
4944
4941
If `callback` is executing on the current thread, then the destructor does
4945
4942
not block ([defns.block] ) waiting for the return from the invocation of
4946
4943
`callback`. Releases</del> <ins> Executes a stoppable callback deregistration
4947
- ([stoptoken.concepts] ), and releases</ins> ownership of the stop state, if
4944
+ ([stoptoken.concepts] ) and releases</ins> ownership of the stop state, if
4948
4945
any.
4949
4946
4950
-
4951
4947
</div>
4952
4948
4949
+ <!-- LWG stopped here. -->
4950
+
4953
4951
4954
4952
<span class="ed-note"> Insert a new subclause, Class `never_stop_token`
4955
4953
<b> [stoptoken.never] </b> , after subclause Class template `stop_callback`
@@ -5147,9 +5145,9 @@ added above, as a new subclause of Stop tokens <b>[thread.stoptoken]</b>.</span>
5147
5145
using callback_type = CallbackFn;
5148
5146
5149
5147
// [stopcallback.inplace.cons] , constructors and destructor
5150
- template<class CBF >
5151
- explicit inplace_stop_callback(inplace_stop_token st, CBF && cbfn )
5152
- noexcept(is_nothrow_constructible_v<CallbackFn, CBF >);
5148
+ template<class Initializer >
5149
+ explicit inplace_stop_callback(inplace_stop_token st, Initializer && init )
5150
+ noexcept(is_nothrow_constructible_v<CallbackFn, Initializer >);
5153
5151
~inplace_stop_callback();
5154
5152
5155
5153
inplace_stop_callback(inplace_stop_callback&&) = delete;
@@ -5171,32 +5169,31 @@ added above, as a new subclause of Stop tokens <b>[thread.stoptoken]</b>.</span>
5171
5169
template parameter `CallbackFn` that satisfies both `invocable` and
5172
5170
`destructible`.
5173
5171
5174
- 2. *Remarks:* For a type `CBF `, if
5172
+ 2. *Remarks:* For a type `Initializer `, if
5175
5173
<code><i> stoppable-callback-for</i> <CallbackFn, inplace_stop_token,
5176
- CBF ></code> is satisfied, then
5174
+ Initializer ></code> is satisfied, then
5177
5175
<code><i> stoppable-callback-for</i> <CallbackFn, inplace_stop_token,
5178
- CBF ></code> is modeled. The exposition-only <i> `callback-fn`</i> member is
5179
- the associated callback function ([stoptoken.concepts] ) of
5176
+ Initializer ></code> is modeled. The exposition-only <i> `callback-fn`</i>
5177
+ member is the associated callback function ([stoptoken.concepts] ) of
5180
5178
`inplace_stop_callback<CallbackFn>` objects.
5181
5179
5182
- Implementations are not permitted to use additional storage, such
5183
- as dynamic memory, to store the state necessary for an
5184
- `inplace_stop_callback`'s association with an `inplace_stop_source` object
5185
- or to register the callback invocation with the associated
5186
- `inplace_stop_source` object.
5180
+ Implementations are not permitted to use additional storage, such as dynamic
5181
+ memory, to store the state necessary for an `inplace_stop_callback`'s
5182
+ association with an `inplace_stop_source` object or to register the callback
5183
+ invocation with the associated `inplace_stop_source` object.
5187
5184
5188
5185
#### Constructors and destructor <b> [stopcallback.inplace.cons] </b> #### {#spec-stopcallback.inplace.cons}
5189
5186
5190
5187
<pre highlight="c++">
5191
- template<class CBF >
5192
- explicit inplace_stop_callback(inplace_stop_token st, CBF && cbfn )
5193
- noexcept(is_nothrow_constructible_v<CallbackFn, CBF >);
5188
+ template<class Initializer >
5189
+ explicit inplace_stop_callback(inplace_stop_token st, Initializer && init )
5190
+ noexcept(is_nothrow_constructible_v<CallbackFn, Initializer >);
5194
5191
</pre>
5195
5192
5196
- 1. *Constraints*: `constructible_from<CallbackFn, CBF >` is satisfied.
5193
+ 1. *Constraints*: `constructible_from<CallbackFn, Initializer >` is satisfied.
5197
5194
5198
5195
2. *Effects*: Initializes <i> `callback-fn`</i> with
5199
- `std::forward<CBF>(cbfn )` and executes a stoppable callback registration
5196
+ `std::forward<Initializer>(init )` and executes a stoppable callback registration
5200
5197
([stoptoken.concepts] ).
5201
5198
5202
5199
<pre highlight="c++">
0 commit comments