std::stop_token::operator=

来自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 弃用)
原子操作的自由函数
原子标志的自由函数
 
 
std::stop_token& operator=(conststd::stop_token& other )noexcept;
(1) (C++20 起)
std::stop_token& operator=(std::stop_token&& other )noexcept;
(2) (C++20 起)

other 的关联停止状态替换关联停止状态。

1) 复制赋值 other 的关联停止状态给 *this 的。等价于 stop_token(other).swap(*this)
2) 移动赋值 other 的关联停止状态给 *this 的。赋值后 *this 含有先前 other 的关联停止状态,而 other 无关联停止状态。等价于 stop_token(std::move(other)).swap(*this)

[编辑]参数

other - 要与之共享停止状态或从之获取停止状态的另一 stop_token 对象
close