VLink  2.0.0
A high-performance communication middleware
vlink::CancellationRegistration类 参考final

Move-only RAII handle that represents one subscribed cancellation callback. 更多...

#include <cancellation.h>

vlink::CancellationRegistration 的协作图:

Public 成员函数

 CancellationRegistration () noexcept
 Constructs an empty registration that owns no callback slot. 更多...
 
 ~CancellationRegistration ()
 Destructor; detaches the owned callback when cancellation has not yet fired. 更多...
 
 CancellationRegistration (CancellationRegistration &&other) noexcept
 Move constructor; transfers slot ownership and leaves other empty. 更多...
 
CancellationRegistrationoperator= (CancellationRegistration &&other) noexcept
 Move assignment; detaches any current slot then adopts other 's slot. 更多...
 
void reset () noexcept
 Detaches the owned callback and resets to the empty state. 更多...
 
bool valid () const noexcept
 Reports whether the registration still owns an attached callback slot. 更多...
 

友元

class CancellationToken
 
class CancellationSource
 

详细描述

Move-only RAII handle that represents one subscribed cancellation callback.

Each registration owns exactly one slot inside the source's state. Destroying or reset-ing the handle detaches the callback if it has not yet fired; once the source has cancelled the slot is consumed automatically and the handle becomes a benign no-op sink. The type is deliberately move-only to keep slot identity unique.

构造及析构函数说明

◆ CancellationRegistration() [1/2]

vlink::CancellationRegistration::CancellationRegistration ( )
noexcept

Constructs an empty registration that owns no callback slot.

◆ ~CancellationRegistration()

vlink::CancellationRegistration::~CancellationRegistration ( )

Destructor; detaches the owned callback when cancellation has not yet fired.

◆ CancellationRegistration() [2/2]

vlink::CancellationRegistration::CancellationRegistration ( CancellationRegistration &&  other)
noexcept

Move constructor; transfers slot ownership and leaves other empty.

参数
otherSource registration emptied by the move.

成员函数说明

◆ operator=()

CancellationRegistration& vlink::CancellationRegistration::operator= ( CancellationRegistration &&  other)
noexcept

Move assignment; detaches any current slot then adopts other 's slot.

参数
otherSource registration emptied by the move.
返回
Reference to *this.

◆ reset()

void vlink::CancellationRegistration::reset ( )
noexcept

Detaches the owned callback and resets to the empty state.

Idempotent. Safe to call on an empty or already-reset registration.

◆ valid()

bool vlink::CancellationRegistration::valid ( ) const
noexcept

Reports whether the registration still owns an attached callback slot.

返回
true when the slot is live and the source has not yet cancelled.

友元及相关函数文档

◆ CancellationSource

friend class CancellationSource
friend

◆ CancellationToken

friend class CancellationToken
friend

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