#include <cancel.hpp>
◆ State
◆ CancelToken() [1/2]
| pulp::runtime::CancelToken::CancelToken |
( |
| ) |
|
|
defaultnoexcept |
A token that can never be cancelled.
◆ CancelToken() [2/2]
| pulp::runtime::CancelToken::CancelToken |
( |
std::shared_ptr< State > | state | ) |
|
|
inlineexplicitprotectednoexcept |
◆ can_be_cancelled()
| bool pulp::runtime::CancelToken::can_be_cancelled |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
True if this token can ever become cancelled (it is bound to a source).
◆ is_cancelled()
| bool pulp::runtime::CancelToken::is_cancelled |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
True once the owning source has been cancelled.
Lock-free and allocation-free; safe to poll from the audio thread.
◆ make_state()
| std::shared_ptr< State > pulp::runtime::CancelToken::make_state |
( |
| ) |
|
|
staticprotected |
◆ register_callback()
Run fn when the token is cancelled.
If it is already cancelled, fn runs immediately on the calling thread and the returned registration is empty. On a token that cannot be cancelled fn never runs and the registration is empty. Callbacks run in registration order.
◆ request_cancel()
| bool pulp::runtime::CancelToken::request_cancel |
( |
const std::shared_ptr< State > & | state | ) |
|
|
staticprotectednoexcept |
Mark the state cancelled, wake waiters, run callbacks.
Returns true if this call performed the transition.
◆ shares()
| bool pulp::runtime::CancelToken::shares |
( |
const CancelToken & | other | ) |
const |
|
inlinenodiscardnoexcept |
True if both tokens observe the same underlying source.
◆ wait_for_cancellation()
| bool pulp::runtime::CancelToken::wait_for_cancellation |
( |
std::chrono::nanoseconds | timeout | ) |
const |
Block until cancelled or timeout elapses.
Returns true when cancelled. On a token that cannot be cancelled this simply sleeps for timeout. Not for the audio thread.
◆ CancelSource
| friend class CancelSource |
|
friend |
◆ state_
| std::shared_ptr<State> pulp::runtime::CancelToken::state_ |
|
protected |
The documentation for this class was generated from the following file:
- /home/runner/work/pulp/pulp/core/runtime/include/pulp/runtime/cancel.hpp