Section: 32.3.1 [thread.stoptoken.intro] Status: New Submitter: Brian Bi Opened: 2023-04-16 Last modified: 2023-05-24
Priority: 3
View all issues with New status.
Discussion:
The first sentence of 32.3.1 [thread.stoptoken.intro]/5 says:
Calls to the functions
request_stop
,stop_requested
, andstop_possible
do not introduce data races.
This could be read as saying that if you have a program that doesn't contain data races,
and you change it by adding a call to any of these three functions, such a change does not
"introduce" data races into the program. In other words, it could be read as saying that
these three functions don't race with any other member functions on the same
stop_token
or stop_source
object.
stop_token::operator=
were also required to not race. (Also, none of these functions
can avoid racing with the destructor.)
[2023-05-24; Reflector poll]
Set priority to 3 after reflector poll.
"What about get_token
? operator==
?"
"Other functions like get_stop_token
can also be called
concurrently. I think the text is actually correct."
Proposed resolution:
This wording is relative to N4944.
Modify 32.3.1 [thread.stoptoken.intro] as indicated:
-5- Calls to the functions
request_stop
,stop_requested
, andstop_possible
do not introduce data races with each other. A call torequest_stop
that returnstrue
synchronizes with a call tostop_requested
on an associatedstop_token
orstop_source
object that returnstrue
. Registration of a callback synchronizes with the invocation of that callback.