std::stop_token::stop_token

From cppreference.com
< cpp‎ | thread‎ | stop token
 
 
Concurrency support library
Threads
(C++11)
(C++20)
(C++20)
this_thread namespace
(C++11)
(C++11)
(C++11)
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11)(deprecated in C++20)
(C++11)(deprecated in C++20)
Free functions for atomic operations
Free functions for atomic flags
Memory ordering
Mutual exclusion
(C++11)
Generic lock management
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
Condition variables
(C++11)
Semaphores
Latches and barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
(C++11)
 
 
stop_token() noexcept;
(1) (since C++20)
stop_token( const stop_token& other ) noexcept;
(2) (since C++20)
stop_token( stop_token&& other ) noexcept;
(3) (since C++20)

Constructs a new stop_token object.

1) Constructs an empty stop_token with no associated stop-state.
2) Copy constructor. Constructs a stop_token whose associated stop-state is the same as that of other.
3) Move constructor. Constructs a stop_token whose associated stop-state is the same as that of other; other is left empty.

Parameters

other - another stop_token object to construct this stop_token object with

Postconditions

1) stop_possible() and stop_requested() are both false
2) *this and other share the same associated stop-state and compare equal
3) *this has other's previously associated stop-state, and other.stop_possible() is false