Skip to content

Commit ef9a944

Browse files
authored
Merge pull request #219 from cplusplus/LWG-feedback-2024-05-01
LWG feedback from the 2024-05-01 telecon
2 parents a50475d + 7daa09f commit ef9a944

File tree

1 file changed

+81
-84
lines changed

1 file changed

+81
-84
lines changed

execution.bs

Lines changed: 81 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -4278,69 +4278,67 @@ Header `<stop_token>` synopsis <b>[thread.stoptoken.syn]</b> and Class
42784278

42794279
2. An object of type `SCB` has an associated <dfn export=true>callback
42804280
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.
42824282
Direct-non-list-initializing `scb` from arguments `t` and `init` shall
42834283
execute a <dfn export=true>stoppable callback registration</dfn> as
42844284
follows:
42854285

42864286
1. If `t.stop_possible()` is `true`:
42874287

4288-
1. `cbfn` shall be direct-initialized with `init`.
4288+
1. `callback_fn` shall be direct-initialized with `init`.
42894289

42904290
2. Construction of `scb` shall only throw exceptions thrown by the
4291-
initialization of `cbfn` from `init`.
4291+
initialization of `callback_fn` from `init`.
42924292

4293-
3. The callback invocation
4294-
<code>std::forward&lt;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:
42964295

42974296
1. If `t.stop_requested()` evaluates to `false` at the time of
42984297
registration, the callback invocation is added to the stop
42994298
state's list of callbacks such that
4300-
<code>std::forward&lt;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.
43024301

4303-
2. Otherwise,
4304-
<code>std::forward&lt;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.
43084306

43094307
4. If the callback invocation was added to stop state's list of
43104308
callbacks, `scb` shall be associated with the stop state.
43114309

43124310
2. <span class="wg21note">If `t.stop_possible()` is `false`, there is no
43134311
requirement that the initialization of `scb` causes the
4314-
initialization of `cbfn`.</span>
4312+
initialization of `callback_fn`.</span>
43154313

43164314
3. Destruction of `scb` shall execute a <dfn export=true>stoppable callback
43174315
deregistration</dfn> as follows (in order):
43184316

43194317
1. If the constructor of `scb` did not register a callback invocation
43204318
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`
43224320
if it was constructed.
43234321

4324-
2. Otherwise, the invocation of `cbfn` shall be removed from
4322+
2. Otherwise, the invocation of `callback_fn` shall be removed from
43254323
the associated stop state.
43264324

4327-
3. If `cbfn` is concurrently executing on another thread
4325+
3. If `callback_fn` is concurrently executing on another thread
43284326
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`
43314329
strongly happens before ([intro.races]) the destruction of
4332-
`cbfn`.
4330+
`callback_fn`.
43334331

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
43354333
destructor shall not block waiting for the return from the
4336-
invocation of `cbfn`.
4334+
invocation of `callback_fn`.
43374335

43384336
5. A stoppable callback deregistration shall not block on the completion
43394337
of the invocation of some other callback registered with the same
43404338
logical stop state.
43414339

43424340
6. The stoppable callback deregistration shall destroy
4343-
`cbfn`.
4341+
`callback_fn`.
43444342

43454343
4. The `stoppable_token` concept checks for the basic interface of a stop token
43464344
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
43994397
5. If `t` and `u` reference the same stop state, or if both `t` and `u` are
44004398
disengaged, `t == u` is `true`; otherwise, it is `false`.
44014399

4402-
<!-- LWG stopped here on 2024-04-17 -->
4403-
44044400
8. An object whose type models the exposition-only <i>`stoppable-source`</i>
44054401
concept can be queried whether stop has been requested (`stop_requested`)
44064402
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
44204416
};
44214417
</pre>
44224418

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`.
44284424

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`.
44324428

44334429
<span class="ed-note">The following paragraph is moved from the introduction,
44344430
with minor modifications (underlined in green).</span>
@@ -4519,7 +4515,7 @@ namespace std {
45194515
<div class="ins">
45204516

45214517
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>
45234519

45244520
</div>
45254521

@@ -4582,7 +4578,7 @@ void swap(stop_token& rhs) noexcept;
45824578
</pre>
45834579

45844580
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>
45864582

45874583
<pre highlight="c++">
45884584
<del>[[nodiscard]]</del> bool stop_requested() const noexcept;
@@ -4634,11 +4630,11 @@ friend void swap(stop_token& x, stop_token& y) noexcept;
46344630

46354631
#### General <b>[stopsource.general]</b> #### {#spec-stopsource.general}
46364632

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
46384634
request. A stop request made on a `stop_source` object is visible to all
46394635
associated `stop_source` and `stop_token` ([thread.stoptoken]) objects. Once
46404636
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>
46424638

46434639
<pre highlight="c++">
46444640
namespace std {
@@ -4682,9 +4678,10 @@ namespace std {
46824678

46834679
<div class="ins">
46844680
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.
46864682

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`.
46884685

46894686
</div>
46904687

@@ -4755,29 +4752,29 @@ stop_source& operator=(stop_source&& rhs) noexcept;
47554752
void swap(stop_source& rhs) noexcept;
47564753
</pre>
47574754

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>.
47604757

47614758
<pre highlight="c++">
47624759
<del>[[nodiscard]]</del> stop_token get_token() const noexcept;
47634760
</pre>
47644761

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>.
47684765

47694766
<pre highlight="c++">
47704767
<del>[[nodiscard]]</del> bool stop_possible() const noexcept;
47714768
</pre>
47724769

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,
47744771
`false`</del><ins><code><i>stop-state</i> != nullptr</code></ins>.
47754772

47764773
<pre highlight="c++">
47774774
<del>[[nodiscard]]</del> bool stop_requested() const noexcept;
47784775
</pre>
47794776

4780-
3. *Returns:* `true` if <del>`*this` has ownership
4777+
4. *Returns:* `true` if <del>`*this` has ownership
47814778
of</del><ins><i>`stop-state`</i> refers to</ins> a stop state that has
47824779
received a stop request; otherwise, `false`.
47834780

@@ -4786,7 +4783,7 @@ bool request_stop() noexcept;
47864783
</pre>
47874784

47884785
<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
47904787
associated stop state, if any.
47914788

47924789
</div>
@@ -4847,12 +4844,12 @@ namespace std {
48474844
using callback_type = Callback<ins>Fn</ins>;
48484845

48494846
// 33.3.5.2, constructors and destructor
4850-
template&lt;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&lt;Callback<ins>Fn</ins>, C<ins>BF</ins>>);
4853-
template&lt;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&lt;Callback<ins>Fn</ins>, C<ins>BF</ins>>);
4847+
template&lt;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&lt;Callback<ins>Fn</ins>, <del>C</del><ins>Initializer</ins>>);
4850+
template&lt;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&lt;Callback<ins>Fn</ins>, <del>C</del><ins>Initializer</ins>>);
48564853
~stop_callback();
48574854

48584855
stop_callback(const stop_callback&) = delete;
@@ -4882,10 +4879,10 @@ namespace std {
48824879

48834880
<div class="ins">
48844881

4885-
3. *Remarks:* For a type <code>CBF</code>, if
4886-
<code><i>stoppable-callback-for</i>&lt;CallbackFn, stop_token, CBF></code> is
4882+
3. *Remarks:* For a type <code>Initializer</code>, if
4883+
<code><i>stoppable-callback-for</i>&lt;CallbackFn, stop_token, Initializer></code> is
48874884
satisfied, then <code><i>stoppable-callback-for</i>&lt;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
48894886
associated callback function ([stoptoken.concepts]) of
48904887
`stop_callback<CallbackFn>` objects.
48914888

@@ -4894,16 +4891,16 @@ namespace std {
48944891
#### Constructors and destructor <b>[stopcallback.cons]</b> #### {#spec-stopcallback.cons}
48954892

48964893
<pre highlight="c++">
4897-
template&lt;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&lt;Callback<ins>Fn</ins>, C<ins>BF</ins>>);
4900-
template&lt;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&lt;Callback<ins>Fn</ins>, C<ins>BF</ins>>);
4894+
template&lt;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&lt;Callback<ins>Fn</ins>, <del>C</del><ins>Initializer</ins>>);
4897+
template&lt;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&lt;Callback<ins>Fn</ins>, <del>C</del><ins>Initializer</ins>>);
49034900
</pre>
49044901

4905-
1. *Constraints:* <code>Callback<ins>Fn</ins></code> and <code>C<ins>BF</ins></code> satisfy
4906-
<code>constructible_from&lt;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&lt;Callback<ins>Fn</ins>, <del>C</del><ins>Initializer</ins>></code>.
49074904

49084905
<div class="del">
49094906
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>)
49124909

49134910
3. *Effects:* Initializes
49144911
<code><del>callback</del><ins><i>callback-fn</i></ins></code> with
4915-
<code>std::forward&lt;C<ins>BF</ins>>(cb<ins>fn</ins>)</code> <ins> and
4912+
<code>std::forward&lt;<del>C</del><ins>Initializer</ins>>(<del>cb</del><ins>init</ins>)</code> <ins> and
49164913
executes a stoppable callback registration
49174914
([stoptoken.concepts])</ins>. <del>If `st.stop_requested()` is `true`, then
49184915
`std::forward&lt;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>)
49444941
If `callback` is executing on the current thread, then the destructor does
49454942
not block ([defns.block]) waiting for the return from the invocation of
49464943
`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
49484945
any.
49494946

4950-
49514947
</div>
49524948

4949+
<!-- LWG stopped here. -->
4950+
49534951

49544952
<span class="ed-note">Insert a new subclause, Class `never_stop_token`
49554953
<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>
51475145
using callback_type = CallbackFn;
51485146

51495147
// [stopcallback.inplace.cons], constructors and destructor
5150-
template&lt;class CBF>
5151-
explicit inplace_stop_callback(inplace_stop_token st, CBF&& cbfn)
5152-
noexcept(is_nothrow_constructible_v&lt;CallbackFn, CBF>);
5148+
template&lt;class Initializer>
5149+
explicit inplace_stop_callback(inplace_stop_token st, Initializer&& init)
5150+
noexcept(is_nothrow_constructible_v&lt;CallbackFn, Initializer>);
51535151
~inplace_stop_callback();
51545152

51555153
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>
51715169
template parameter `CallbackFn` that satisfies both `invocable` and
51725170
`destructible`.
51735171

5174-
2. *Remarks:* For a type `CBF`, if
5172+
2. *Remarks:* For a type `Initializer`, if
51755173
<code><i>stoppable-callback-for</i>&lt;CallbackFn, inplace_stop_token,
5176-
CBF></code> is satisfied, then
5174+
Initializer></code> is satisfied, then
51775175
<code><i>stoppable-callback-for</i>&lt;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
51805178
`inplace_stop_callback<CallbackFn>` objects.
51815179

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.
51875184

51885185
#### Constructors and destructor <b>[stopcallback.inplace.cons]</b> #### {#spec-stopcallback.inplace.cons}
51895186

51905187
<pre highlight="c++">
5191-
template&lt;class CBF>
5192-
explicit inplace_stop_callback(inplace_stop_token st, CBF&& cbfn)
5193-
noexcept(is_nothrow_constructible_v&lt;CallbackFn, CBF>);
5188+
template&lt;class Initializer>
5189+
explicit inplace_stop_callback(inplace_stop_token st, Initializer&& init)
5190+
noexcept(is_nothrow_constructible_v&lt;CallbackFn, Initializer>);
51945191
</pre>
51955192

5196-
1. *Constraints*: `constructible_from<CallbackFn, CBF>` is satisfied.
5193+
1. *Constraints*: `constructible_from<CallbackFn, Initializer>` is satisfied.
51975194

51985195
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
52005197
([stoptoken.concepts]).
52015198

52025199
<pre highlight="c++">

0 commit comments

Comments
 (0)