C++ Logo


Advanced search

Possible issue in the definition of 'std::stop_source'

From: Raphael <raphael.rg91_at_[hidden]>
Date: Wed, 12 Oct 2022 11:42:11 -0300

the current definition of std::stop_source::stop_possible() [1] states that:

*Returns*: true if *this has ownership of a stop state; otherwise, false.

and the current definition of std::stop_source::stop_requested() [2] states

*Returns*: true if *this has ownership of a stop state that has received a
> stop request; otherwise, false.

from these requirements it appears that stop_requested() will never return
true if stop_possible() return false, but this is exactly what is required
as a post condition of std::stop_source::request_stop() [3], where it says:

*Postconditions*: stop_­possible() is false or stop_­requested() is true.

The issue here appears to be in the definition of
std::stop_source::stop_possible() that should be made equivalent to the
definition of std::stop_token::stop_possible() [4], something like:

*Returns*: true if *this has ownership of a stop state *and a stop request
> was not made*; otherwise, false.

Is this really an issue? If it is, will it be considered an editorial issue
or a defect?


[1] https://eel.is/c++draft/thread.stoptoken#stopsource.mem-2
[2] https://eel.is/c++draft/thread.stoptoken#stopsource.mem-3
[3] https://eel.is/c++draft/thread.stoptoken#stopsource.mem-5
[4] https://eel.is/c++draft/thread.stoptoken#stoptoken.mem-2

Received on 2022-10-12 14:42:23