Namespaces
Variants

std::stop_token:: stop_token

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
stop_token ( ) noexcept ;
(1) (自 C++20 起)
stop_token ( const stop_token & other ) noexcept ;
(2) (自 C++20 起)
stop_token ( stop_token && other ) noexcept ;
(3) (自 C++20 起)

构造一个新的 stop_token 对象。

1) 构造一个空的 stop_token ,没有关联的停止状态。
2) 拷贝构造函数。构造一个 stop_token ,其关联的停止状态与 other 相同。
3) 移动构造函数。构造一个 stop_token ,其关联停止状态与 other 相同; other 将变为空状态。

参数

其他 - 用于构造此 stop_token 对象的另一个 stop_token 对象

后置条件

1) stop_possible() stop_requested() 均为 false
2) * this other 共享相同的关联停止状态且比较结果相等。
3) * this 具有 other 先前关联的停止状态,且 other. stop_possible ( ) false