[stoptoken.general] (original) (raw)

The class stop_­token provides an interface for querying whether a stop request has been made (stop_­requested) or can ever be made (stop_­possible) using an associated stop_­source object ([stopsource]).

A stop_­token can also be passed to astop_­callback ([stopcallback]) constructor to register a callback to be called when a stop request has been made from an associated stop_­source.

namespace std { class stop_token { public: stop_token() noexcept; stop_token(const stop_token&) noexcept; stop_token(stop_token&&) noexcept; stop_token& operator=(const stop_token&) noexcept; stop_token& operator=(stop_token&&) noexcept;~stop_token();void swap(stop_token&) noexcept;[[nodiscard]] bool stop_requested() const noexcept;[[nodiscard]] bool stop_possible() const noexcept;[[nodiscard]] friend bool operator==(const stop_token& lhs, const stop_token& rhs) noexcept;friend void swap(stop_token& lhs, stop_token& rhs) noexcept;};}