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_possibledo 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_possibledo not introduce data races with each other. A call torequest_stopthat returnstruesynchronizes with a call tostop_requestedon an associatedstop_tokenorstop_sourceobject that returnstrue. Registration of a callback synchronizes with the invocation of that callback.