33 Concurrency support library [thread]

33.3 Stop tokens [thread.stoptoken]

33.3.3 Class stop_token [stoptoken]

33.3.3.3 Members [stoptoken.mem]

[[nodiscard]] bool stop_requested() const noexcept;
Returns: true if *this has ownership of a stop state that has received a stop request; otherwise, false.
[[nodiscard]] bool stop_possible() const noexcept;
Returns: false if:
  • *this does not have ownership of a stop state, or
  • a stop request was not made and there are no associated stop_source objects;
otherwise, true.