32 Thread support library [thread]

32.3 Stop tokens [thread.stoptoken]

32.3.4 Class stop_­source [stopsource]

32.3.4.2 Constructors, copy, and assignment [stopsource.cons]

stop_source();
Effects: Initialises *this to have ownership of a new stop state.
Postconditions: stop_­possible() is true and stop_­requested() is false.
Throws: bad_­alloc if memory cannot be allocated for the stop state.
explicit stop_source(nostopstate_t) noexcept;
Postconditions: stop_­possible() is false and stop_­requested() is false.
[Note 1:
No resources are allocated for the state.
— end note]
stop_source(const stop_source& rhs) noexcept;
Postconditions: *this == rhs is true.
[Note 2:
*this and rhs share the ownership of the same stop state, if any.
— end note]
stop_source(stop_source&& rhs) noexcept;
Postconditions: *this contains the value of rhs prior to the start of construction and rhs.stop_­possible() is false.
~stop_source();
Effects: Releases ownership of the stop state, if any.
stop_source& operator=(const stop_source& rhs) noexcept;
Effects: Equivalent to: stop_­source(rhs).swap(*this).
Returns: *this.
stop_source& operator=(stop_source&& rhs) noexcept;
Effects: Equivalent to: stop_­source(std​::​move(rhs)).swap(*this).
Returns: *this.
void swap(stop_source& rhs) noexcept;
Effects: Exchanges the values of *this and rhs.