NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
cancellation_token类 参考

取消令牌 更多...

#include <generator.hpp>

struct  check_awaiter
 取消检查等待器 更多...

Public 成员函数

 cancellation_token ()
 默认构造函数,创建新的取消令牌
 cancellation_token (const cancellation_token &other)
 拷贝构造函数,共享状态
cancellation_tokenoperator= (const cancellation_token &other)
 拷贝赋值运算符
 ~cancellation_token ()
 析构函数,释放状态
void cancel () noexcept
 请求取消
bool is_cancelled () const noexcept
 检查是否已被取消
check_awaiter check () const
 获取取消检查等待器

详细描述

取消令牌

用于协程的取消操作,支持多个副本共享同一个取消状态。 可以传递给协程,在适当的位置检查取消状态并抛出异常。

在文件 generator.hpp34 行定义.

构造及析构函数说明

◆ cancellation_token()

cancellation_token::cancellation_token ( const cancellation_token & other)
inline

拷贝构造函数,共享状态

参数
other另一个取消令牌

在文件 generator.hpp95 行定义.

引用了 cancellation_token() , 以及 memory_order_relaxed.

成员函数说明

◆ check()

check_awaiter cancellation_token::check ( ) const
inline

获取取消检查等待器

返回
检查等待器

在文件 generator.hpp144 行定义.

◆ is_cancelled()

bool cancellation_token::is_cancelled ( ) const
inlinenoexcept

检查是否已被取消

返回
是否已被取消

在文件 generator.hpp138 行定义.

引用了 memory_order_acquire.

◆ operator=()

cancellation_token & cancellation_token::operator= ( const cancellation_token & other)
inline

拷贝赋值运算符

参数
other另一个取消令牌
返回
自身引用

在文件 generator.hpp107 行定义.

引用了 addressof(), cancellation_token() , 以及 memory_order_relaxed.


该类的文档由以下文件生成: