Skip to content

Commit d68eeca

Browse files
committed
LWG feedback from 2024-04-17
1 parent 8d07690 commit d68eeca

File tree

1 file changed

+47
-44
lines changed

1 file changed

+47
-44
lines changed

execution.bs

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4135,7 +4135,8 @@ namespace std {
41354135
respectively.</ins><del> The last remaining owner of the stop state
41364136
automatically releases the resources associated with the stop state.</del>
41374137

4138-
3. A <code>stop<ins>pable</ins>_token</code> can be passed to an operation <del>
4138+
3. A<ins>n object of a type that models</ins>
4139+
<code>stop<ins>pable</ins>_token</code> can be passed to an operation <del>
41394140
which</del><ins>that</ins> can either
41404141

41414142
<div class="numbered" style="counter-set: paragraph 3 list_item 0">
@@ -4146,15 +4147,15 @@ namespace std {
41464147
template which</del><ins>that</ins> will be called in the event that a
41474148
stop request is made.</div>
41484149

4149-
A stop request made via <del>a `stop_source`</del><ins>an object that models
4150-
<i>`stoppable-source`</i></ins> will be visible to all associated
4150+
A stop request made via <del>a `stop_source`</del><ins>an object whose type
4151+
models <i>`stoppable-source`</i></ins> will be visible to all associated
41514152
<code>stop<ins>pable</ins>_token</code> and <del>`stop_source`</del><ins>
4152-
<i>`stoppable-source`</i></ins> objects. Once a stop request has been
4153-
made it cannot be withdrawn (a subsequent stop request has no effect).
4153+
<i>`stoppable-source`</i></ins> objects. Once a stop request has been made
4154+
it cannot be withdrawn (a subsequent stop request has no effect).
41544155

41554156
4. Callbacks registered via <del>a `stop_callback` object</del><ins>an object
4156-
that models <i>`stoppable-callback-for`</i></ins> are called when a stop
4157-
request is first made by any associated <del>`stop_source`</del><ins>
4157+
whose type models <i>`stoppable-callback-for`</i></ins> are called when a
4158+
stop request is first made by any associated <del>`stop_source`</del><ins>
41584159
<i>`stoppable-source`</i></ins> object.
41594160

41604161
<span class="ed-note">The following paragraph is moved to the specification of
@@ -4177,10 +4178,11 @@ the new <i>`stoppable-source`</i> concept.</span>
41774178
The last remaining owner of the stop state automatically releases the
41784179
resources associated with the stop state.
41794180

4180-
6. The types `inplace_stop_source` and `inplace_stop_token` and the class
4181-
template `inplace_stop_callback` does no dynamic memory allocation of the
4182-
stop state. <span class="wg21note">They are for use when the lifetimes of
4183-
the associated token and callback objects are known to nest within the
4181+
6. An object of type `inplace_stop_source` is the sole owner of its stop state.
4182+
An object of type `inplace_stop_token` or of a specialization of the class
4183+
template `inplace_stop_callback` does not participate in ownership of its
4184+
associated stop state. <span class="wg21note">They are for use when all uses
4185+
of the associated token and callback objects are known to nest within the
41844186
lifetime of the `inplace_stop_source` object.</span>
41854187

41864188
</div>
@@ -4233,13 +4235,13 @@ namespace std {
42334235
template&lt;class CallbackFn>
42344236
class inplace_stop_callback;
42354237

4238+
<span class="ed-note">Do we need the `::template` here?</span>
42364239
template&lt;class T, class CallbackFn>
42374240
using stop_callback_for_t = T::template callback_type&lt;CallbackFn>;</div>
42384241
}
42394242
</pre>
42404243
</div>
42414244

4242-
42434245
<span class="ed-note">Insert the following subclause as a new subclause between
42444246
Header `<stop_token>` synopsis <b>[thread.stoptoken.syn]</b> and Class
42454247
`stop_token` <b>[stoptoken]</b>.</span>
@@ -4248,13 +4250,8 @@ Header `<stop_token>` synopsis <b>[thread.stoptoken.syn]</b> and Class
42484250

42494251
### Stop token concepts <b>[stoptoken.concepts]</b> ### {#spec-stoptoken.concepts}
42504252

4251-
1. For a stop token type `Token` and a type `CallbackFn` such that
4252-
<code>invocable&lt;CallbackFn></code> is `true`, if the type
4253-
`stop_callback_for_t<Token, CallbackFn>` is valid, it denotes the type of a
4254-
stop callback to use when registering a callback invocation to be executed
4255-
if a stop request is made on the `stoppable_token`'s associated stop source.
4256-
The exposition-only <i>`stoppable-callback-for`</i> concept checks for a
4257-
callback compatible with a given stop token type.
4253+
1. The exposition-only <i>`stoppable-callback-for`</i> concept checks for a
4254+
callback compatible with a given `Token` type.
42584255

42594256
<pre highlight="c++">
42604257
template&lt;class CallbackFn, class Token, class Initializer = CallbackFn>
@@ -4266,9 +4263,9 @@ Header `<stop_token>` synopsis <b>[thread.stoptoken.syn]</b> and Class
42664263
</pre>
42674264

42684265
2. Let `t` and `u` be distinct, valid objects of type `Token` that reference the
4269-
same logical stop state; let `init` be an object of type
4270-
`Initializer`; and let `SCB` denote the type `stop_callback_for_t<Token,
4271-
CallbackFn>`.
4266+
same logical stop state; let `init` be an expression such that
4267+
`same_as<decltype(init), Initializer>` is `true`; and let `SCB` denote the
4268+
type `stop_callback_for_t<Token, CallbackFn>`.
42724269

42734270
3. The concept <code><i>stoppable-callback-for</i>&lt;CallbackFn, Token,
42744271
Initializer></code> is modeled only if:
@@ -4317,11 +4314,12 @@ Header `<stop_token>` synopsis <b>[thread.stoptoken.syn]</b> and Class
43174314
initialization of `cbfn`.</span>
43184315

43194316
3. Destruction of `scb` shall execute a <dfn export=true>stoppable callback
4320-
deregistration</dfn> as follows:
4317+
deregistration</dfn> as follows (in order):
43214318

43224319
1. If the constructor of `scb` did not register a callback invocation
43234320
with `t`'s stop state, then the stoppable callback
4324-
deregistration shall have no effect.
4321+
deregistration shall have no effect other than destroying `cbfn`
4322+
if it was constructed.
43254323

43264324
2. Otherwise, the invocation of `cbfn` shall be removed from
43274325
the associated stop state.
@@ -4341,13 +4339,13 @@ Header `<stop_token>` synopsis <b>[thread.stoptoken.syn]</b> and Class
43414339
of the invocation of some other callback registered with the same
43424340
logical stop state.
43434341

4344-
6. As a final step, the stoppable callback deregistration shall destroy
4342+
6. The stoppable callback deregistration shall destroy
43454343
`cbfn`.
43464344

43474345
4. The `stoppable_token` concept checks for the basic interface of a stop token
43484346
that is copyable and allows polling to see if stop has been requested and
43494347
also whether a stop request is possible. The `unstoppable_token` concept
4350-
checks for a stop token type that does not allow stopping.
4348+
checks for a `stoppable_token` type that does not allow stopping.
43514349

43524350
<pre highlight="c++">
43534351
template&lt;template&lt;class> class>
@@ -4374,31 +4372,36 @@ Header `<stop_token>` synopsis <b>[thread.stoptoken.syn]</b> and Class
43744372
};
43754373
</pre>
43764374

4377-
5. The type `Token` models `stoppable_token` only if:
4375+
5. An object whose type models `stoppable_token` has at most one associated
4376+
logical stop state. A `stoppable_token` object with no associated stop
4377+
state is said to be <dfn export=true>disengaged</dfn>.
4378+
4379+
6. Let `SP` be an evaluation of `t.stop_possible()` that is `false`, and let
4380+
`SR` be an evaluation of `t.stop_requested()` that is `true`.
4381+
4382+
7. The type `Token` models `stoppable_token` only if:
43784383

4379-
1. An evaluation, `E`, of `t.stop_possible()` is `false`, then
4380-
evaluations of `u.stop_possible()` and `u.stop_requested()` that happen
4381-
after `E` shall evaluate to `false`.
4384+
1. Any evaluation of `u.stop_possible()` or `u.stop_requested()`
4385+
that happens after ([intro.races]) `SP` is `false`.
43824386

4383-
2. An evaluation, `E`, of `t.stop_requested()` is `true`, then
4384-
evaluations of `u.stop_possible()` and `u.stop_requested()` that happen
4385-
after `E` shall evaluate to `true`.
4387+
2. Any evaluation of `u.stop_possible()` or `u.stop_requested()`
4388+
that happens after `SR` is `true`.
43864389

4387-
3. For any types `CallbackFn` and `Initializer`, if
4390+
3. For any types `CallbackFn` and `Initializer` such that
43884391
<code><i>stoppable-callback-for</i>&lt;CallbackFn, Token,
4389-
Initializer></code> is satisfied, then
4392+
Initializer></code> is satisfied,
43904393
<code><i>stoppable-callback-for</i>&lt;CallbackFn, Token,
4391-
Initializer></code> shall be modeled.
4394+
Initializer></code> is modeled.
4395+
4396+
4. If `t` is disengaged, evaluations of `t.stop_possible()` and
4397+
`t.stop_requested()` are `false`.
4398+
4399+
5. If `t` and `u` reference the same stop state, or if both `t` and `u` are
4400+
disengaged, `t == u` is `true`; otherwise, it is `false`.
43924401

4393-
4. An object that models `stoppable_token` has at most one associated
4394-
logical stop state. A `stoppable_token` object with no associated stop
4395-
state is said to be <dfn export=true>disengaged</dfn>. For a disengaged
4396-
`stoppable_token` object, `stop_possible` and `stop_requested` shall
4397-
return `false`. If `t` and `u` reference the same stop state, or if both
4398-
`t` and `u` are disengaged, `t == u` shall be `true`; otherwise, it
4399-
shall be `false`.
4402+
<!-- LWG stopped here on 2024-04-17 -->
44004403

4401-
6. An object whose type models the exposition-only <i>`stoppable-source`</i>
4404+
8. An object whose type models the exposition-only <i>`stoppable-source`</i>
44024405
concept can be queried whether stop has been requested (`stop_requested`)
44034406
and whether stop is possible (`stop_possible`). It is a factory for
44044407
associated stop tokens (`get_token`), and a stop request can be made on it

0 commit comments

Comments
 (0)