Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::runtime::CancelSource Class Reference

Move-only owner of a cancellation state. More...

#include <cancel.hpp>

Public Member Functions

 CancelSource ()
 ~CancelSource ()
 CancelSource (const CancelSource &)=delete
CancelSource & operator= (const CancelSource &)=delete
 CancelSource (CancelSource &&other) noexcept=default
CancelSource & operator= (CancelSource &&other) noexcept
 Cancels the state this source currently owns, then takes over other.
CancelToken token () const noexcept
 Observer for this source. Tokens remain valid after the source dies.
bool cancel () noexcept
 Signal cancellation.
bool is_cancelled () const noexcept

Detailed Description

Move-only owner of a cancellation state.

Cancels when destroyed, so work observing a token never outlives the scope that owns the source without being told to stop.

Constructor & Destructor Documentation

◆ CancelSource() [1/3]

pulp::runtime::CancelSource::CancelSource ( )

◆ ~CancelSource()

pulp::runtime::CancelSource::~CancelSource ( )

◆ CancelSource() [2/3]

pulp::runtime::CancelSource::CancelSource ( const CancelSource & )
delete

◆ CancelSource() [3/3]

pulp::runtime::CancelSource::CancelSource ( CancelSource && other)
defaultnoexcept

Member Function Documentation

◆ cancel()

bool pulp::runtime::CancelSource::cancel ( )
noexcept

Signal cancellation.

Idempotent. Returns true if this call was the one that cancelled. Wakes wait_for_cancellation callers and runs registered callbacks on the calling thread.

◆ is_cancelled()

bool pulp::runtime::CancelSource::is_cancelled ( ) const
inlinenodiscardnoexcept

◆ operator=() [1/2]

CancelSource & pulp::runtime::CancelSource::operator= ( CancelSource && other)
noexcept

Cancels the state this source currently owns, then takes over other.

◆ operator=() [2/2]

CancelSource & pulp::runtime::CancelSource::operator= ( const CancelSource & )
delete

◆ token()

CancelToken pulp::runtime::CancelSource::token ( ) const
inlinenodiscardnoexcept

Observer for this source. Tokens remain valid after the source dies.


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/runtime/include/pulp/runtime/cancel.hpp