Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::async::CancellationToken Class Reference

#include <cancellation.hpp>

Public Member Functions

 CancellationToken ()=default
 CancellationToken (std::shared_ptr< detail::CancellationState > s)
bool is_cancelled () const noexcept
void throw_if_cancelled () const
 Throw OperationCancelled if cancelled. Call at safe await points.
void on_cancel (std::function< void()> cb)
 Register a callback fired (synchronously) when source is cancelled.

Static Public Member Functions

static CancellationToken none () noexcept
 Always-cancellable empty token (useful as a default).

Constructor & Destructor Documentation

◆ CancellationToken() [1/2]

aria::async::CancellationToken::CancellationToken ( )
default

◆ CancellationToken() [2/2]

aria::async::CancellationToken::CancellationToken ( std::shared_ptr< detail::CancellationState > s)
inlineexplicit

Member Function Documentation

◆ is_cancelled()

bool aria::async::CancellationToken::is_cancelled ( ) const
inlinenodiscardnoexcept

◆ throw_if_cancelled()

void aria::async::CancellationToken::throw_if_cancelled ( ) const
inline

Throw OperationCancelled if cancelled. Call at safe await points.

◆ on_cancel()

void aria::async::CancellationToken::on_cancel ( std::function< void()> cb)
inline

Register a callback fired (synchronously) when source is cancelled.

If already cancelled, invoked immediately.

◆ none()

CancellationToken aria::async::CancellationToken::none ( )
inlinestaticnodiscardnoexcept

Always-cancellable empty token (useful as a default).


The documentation for this class was generated from the following file: