std::stop_token::stop_token

来自cppreference.com
< cpp‎ | thread‎ | stop token
 
 
并发支持库
线程
(C++11)
(C++20)
this_thread 命名空间
(C++11)
(C++11)
(C++11)
协作式取消
互斥
通用锁管理
(C++11)
(C++11)
(C++11)
(C++11)
条件变量
(C++11)
信号量
闩与屏障
(C++20)
(C++20)
未来体
(C++11)
(C++11)
(C++11)
安全回收
风险指针
原子类型
(C++11)
(C++20)
原子类型的初始化
(C++11)(C++20 弃用)
(C++11)(C++20 弃用)
内存定序
(C++11)(C++26 弃用)
原子操作的自由函数
原子标志的自由函数
 
 
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) 复制构造函数。构造关联停止状态与 other 相同的 stop_token
3) 移动构造函数。构造关联停止状态与 other 相同的 stop_token;将 other 置于空状态。

参数

other-用于构造此 stop_token 对象的另一 stop_token 对象

后条件

1)stop_possible()stop_requested() 均为 false
2)*thisother 共享同一停止状态且比较相等。
3)*this 拥有 other 先前的停止状态,而 other.stop_possible()false