Namespaces
Variants

std:: stoppable_token

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
定义于头文件 <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 起)
辅助模板
template < template < class > class >
struct /*check-type-alias-exists*/ ; // 未定义
( 仅用于阐释* )

概念 stoppable_token<Token> 规定了可停止令牌的基本接口,该令牌需满足 copyable equality_comparable 要求,并允许轮询检查是否可能发出停止请求以及是否已发出停止请求。

语义要求

参见

指定不允许停止的停止令牌
(概念)