33 Concurrency support library [thread]

33.3 Stop tokens [thread.stoptoken]

33.3.4 Class stop_token [stoptoken]

33.3.4.2 Member functions [stoptoken.mem]

void swap(stop_token& rhs) noexcept;
Effects: Equivalent to: stop-state.swap(rhs.stop-state);
bool stop_requested() const noexcept;
Returns: true if stop-state refers to a stop state that has received a stop request; otherwise, false.
bool stop_possible() const noexcept;
Returns: false if
  • *this is disengaged, or
  • a stop request was not made and there are no associated stop_source objects;
otherwise, true.