std::stoppable_token

来自cppreference.com
< cpp‎ | thread
 
 
并发支持库
线程
(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> 定义
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;// 参见“隐式表达式变体”
    }&&
    std::copyable<Token>&&

    std::equality_comparable<Token>;
(C++26 起)
Helper templates
template<template<class>class>
struct/*check-type-alias-exists*/;// 不予定义
(仅用于阐述*)

概念 stoppable_token<Token> 指定一种停止令牌的基本接口,它为 copyableequality_comparable,并允许进行轮询以检查是否可能请求停止及是否已做出请求。

[编辑]语义要求

[编辑]参阅

指定一种不允许停止的停止令牌
(概念)[编辑]
close