32 Concurrency support library [thread]

32.3 Stop tokens [thread.stoptoken]

32.3.5 Class stop_source [stopsource]

32.3.5.3 Member functions [stopsource.mem]

void swap(stop_source& rhs) noexcept;
Effects: Equivalent to: stop-state.swap(rhs.stop-state);
stop_token get_token() const noexcept;
Returns: stop_token() if stop_possible() is false; otherwise a new associated stop_token object; i.e., its stop-state member is equal to the stop-state member of *this.
bool stop_possible() const noexcept;
Returns: stop-state != nullptr.
bool stop_requested() const noexcept;
Returns: true if stop-state refers to a stop state that has received a stop request; otherwise, false.
bool request_stop() noexcept;
Effects: Executes a stop request operation ([stoptoken.concepts]) on the associated stop state, if any.