32 Thread support library [thread]

32.3 Stop tokens [thread.stoptoken]

32.3.3 Class stop_­token [stoptoken]

32.3.3.1 Constructors, copy, and assignment [stoptoken.cons]

stop_token() noexcept;
Postconditions: stop_­possible() is false and stop_­requested() is false.
[Note
:
Because the created stop_­token object can never receive a stop request, no resources are allocated for a stop state.
— end note
]
stop_token(const stop_token& rhs) noexcept;
Postconditions: *this == rhs is true.
[Note
:
*this and rhs share the ownership of the same stop state, if any.
— end note
]
stop_token(stop_token&& rhs) noexcept;
Postconditions: *this contains the value of rhs prior to the start of construction and rhs.stop_­possible() is false.
~stop_token();
Effects: Releases ownership of the stop state, if any.
stop_token& operator=(const stop_token& rhs) noexcept;
Effects: Equivalent to: stop_­token(rhs).swap(*this).
Returns: *this.
stop_token& operator=(stop_token&& rhs) noexcept;
Effects: Equivalent to: stop_­token(std​::​move(rhs)).swap(*this).
Returns: *this.
void swap(stop_token& rhs) noexcept;
Effects: Exchanges the values of *this and rhs.