|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Read-only cooperative cancellation token. More...
#include <thread_pool.H>
Classes | |
| class | ConditionVariableRegistration |
| RAII guard for condition variable cancellation registration. More... | |
Public Member Functions | |
| CancellationToken ()=default | |
| Default constructor. | |
| bool | stop_requested () const noexcept |
| Return true if cancellation has been requested. | |
| bool | is_cancellation_requested () const noexcept |
| Synonym for stop_requested(). | |
| void | throw_if_cancellation_requested () const |
| Throw operation_canceled if cancellation was requested. | |
| bool | valid () const noexcept |
| Return true if the token is connected to a source. | |
| ConditionVariableRegistration | notify_on_cancel (std::condition_variable &cv) const |
| Request notification of a condition variable on cancellation. | |
Private Member Functions | |
| CancellationToken (std::shared_ptr< CancellationState > state) noexcept | |
Private Attributes | |
| std::shared_ptr< CancellationState > | state_ |
Friends | |
| class | CancellationSource |
Read-only cooperative cancellation token.
Tokens are cheap to copy and can be captured by tasks. They never force a task to stop; instead, user code or higher-level helpers can observe the request and exit gracefully.
Definition at line 199 of file thread_pool.H.
|
inlineexplicitprivatenoexcept |
Definition at line 203 of file thread_pool.H.
|
default |
Default constructor.
|
inlinenoexcept |
Synonym for stop_requested().
Definition at line 274 of file thread_pool.H.
References stop_requested().
|
inline |
Request notification of a condition variable on cancellation.
This is primarily intended for blocking helpers that need to wake up promptly when cooperative cancellation is requested.
Definition at line 294 of file thread_pool.H.
References Aleph::divide_and_conquer_partition_dp(), state_, and stop_requested().
Referenced by Aleph::BoundedChannel< T >::wait_with_cancellation().
|
inlinenoexcept |
Return true if cancellation has been requested.
Definition at line 268 of file thread_pool.H.
References Aleph::and, and state_.
Referenced by is_cancellation_requested(), notify_on_cancel(), throw_if_cancellation_requested(), and Aleph::BoundedChannel< T >::wait_with_cancellation().
|
inline |
Throw operation_canceled if cancellation was requested.
Definition at line 280 of file thread_pool.H.
References stop_requested().
Referenced by Aleph::parallel_detail::throw_if_canceled(), Aleph::parallel_detail::throw_if_parallel_canceled(), and Aleph::BoundedChannel< T >::wait_with_cancellation().
|
inlinenoexcept |
Return true if the token is connected to a source.
Definition at line 287 of file thread_pool.H.
References state_.
|
friend |
Definition at line 206 of file thread_pool.H.
|
private |
Definition at line 201 of file thread_pool.H.
Referenced by notify_on_cancel(), stop_requested(), and valid().