命名空间
变体
操作

std::stop_token::operator=

来自 cppreference.cn
< 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++11)
条件变量
(C++11)
信号量
闩锁和屏障
(C++20)
(C++20)
期物
(C++11)
(C++11)
(C++11)
(C++11)
安全回收
(C++26)
Hazard 指针
原子类型
(C++11)
(C++20)
原子类型的初始化
(C++11)(C++20 中已弃用)
(C++11)(C++20 中已弃用)
内存顺序
(C++11)(C++26 中已弃用)
原子操作的自由函数
原子标志的自由函数
 
 
std::stop_token& operator=( const std::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 对象,用于与之共享停止状态或从中获取停止状态