命名空间
变体
操作

std::stoppable_token

来自 cppreference.cn
< cpp‎ | thread
 
 
并发支持库
线程
(C++11)
(C++20)
this_thread 命名空间
(C++11)
(C++11)
(C++11)
协同取消
stoppable_token
(C++26)
互斥
(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)
危险指针
原子类型
(C++11)
(C++20)
原子类型的初始化
(C++11)(C++20 中已弃用)
(C++11)(C++20 中已弃用)
内存排序
(C++11)(C++26 中已弃用)
原子操作的自由函数
原子标志的自由函数
 
定义于头文件 <stop_token>
template< class Token >

concept stoppable_token =
    requires (const Token tok) {
        typename /*check-type-alias-exists*/<Token::template callback_type>;
        { tok.stop_requested() } noexcept -> std::same_as<bool>;
        { tok.stop_possible() } noexcept -> std::same_as<bool>;
        { Token(tok) } noexcept; // see implicit expression variations
    } &&
    std::copyable<Token> &&

    std::equality_comparable<Token>;
(C++26 起)
帮助模板
template< template<class> class >
struct /*check-type-alias-exists*/; // not defined
(仅作说明*)

概念 stoppable_token<Token> 指定了一个停止令牌的基本接口,该令牌是 可复制的可相等比较的,并允许轮询以查看停止请求是否可能以及请求是否已发出。

[编辑] 语义要求

[编辑] 参阅

指定不允许停止的停止令牌
(concept) [编辑]