Former name of the shared token.
More...
#include <cancel.hpp>
Former name of the shared token.
It both observes and requests cancellation: every copy shares state and any copy may call cancel(). A default-constructed instance owns live state. New code should hold a CancelSource and pass CancelToken to the work being cancelled; a CancellationToken converts to CancelToken implicitly. Unlike CancelSource it does not cancel on destruction.
◆ State
◆ CancellationToken()
| pulp::runtime::CancellationToken::CancellationToken |
( |
| ) |
|
◆ can_be_cancelled()
| bool pulp::runtime::CancelToken::can_be_cancelled |
( |
| ) |
const |
|
inlinenodiscardnoexceptinherited |
True if this token can ever become cancelled (it is bound to a source).
◆ cancel()
| void pulp::runtime::CancellationToken::cancel |
( |
| ) |
|
|
inlinenoexcept |
◆ is_cancelled()
| bool pulp::runtime::CancelToken::is_cancelled |
( |
| ) |
const |
|
inlinenodiscardnoexceptinherited |
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 |
( |
| ) |
|
|
staticprotectedinherited |
◆ 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 | ) |
|
|
staticprotectednoexceptinherited |
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 |
|
inlinenodiscardnoexceptinherited |
True if both tokens observe the same underlying source.
◆ wait_for_cancellation()
| bool pulp::runtime::CancelToken::wait_for_cancellation |
( |
std::chrono::nanoseconds | timeout | ) |
const |
|
inherited |
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.
◆ state_
| std::shared_ptr<State> pulp::runtime::CancelToken::state_ |
|
protectedinherited |
The documentation for this class was generated from the following file:
- /home/runner/work/pulp/pulp/core/runtime/include/pulp/runtime/cancel.hpp