Namespaces
Variants

std:: never_stop_token

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
(C++20)
never_stop_token
(C++26)
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>
class never_stop_token ;
(C++26 起)

never_stop_token 类模拟 unstoppable_token ,提供静态信息表明停止既不可能发生也不会被请求。如果在可查询对象中未提供其他关联的停止令牌,该类型将作为 std::get_stop_token 返回的默认停止令牌类型。

目录

成员别名模板

类型 定义
callback_type < Callback > /*callback-type*/
其中类型定义为:
struct /*callback-type*/

{
explicit /*callback-type*/ ( never_stop_token,
auto && ) noexcept { }

} ;
( 仅用于说明* )

成员函数

stop_requested
[static]
指示永远无法请求停止
(公开静态成员函数)
stop_possible
[static]
指示停止不可能发生
(公开静态成员函数)
operator==
比较两个 never_stop_token 对象
(公开成员函数)

std::never_stop_token:: stop_requested

static constexpr bool stop_requested ( ) noexcept { return false ; }

始终返回 false ,表明永远无法请求停止。

std::never_stop_token:: stop_possible

static constexpr bool stop_possible ( ) noexcept { return false ; }

始终返回 false ,表示停止请求不可能发生。

std::never_stop_token:: operator==

bool operator == ( const never_stop_token & ) const = default ;

两个 never_stop_token 对象总是比较相等。

示例