Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CancellationSource Class Reference

Cooperative cancellation source paired with CancellationToken. More...

#include <thread_pool.H>

Collaboration diagram for Aleph::CancellationSource:
[legend]

Public Member Functions

 CancellationSource ()=default
 Default constructor.
 
CancellationToken token () const noexcept
 Return a token observing this source.
 
void request_cancel () noexcept
 Request cancellation for all derived tokens.
 
void cancel () noexcept
 Synonym for request_cancel().
 
bool stop_requested () const noexcept
 Return true if cancellation has already been requested.
 
void reset ()
 Reset the source so future tokens observe a fresh state.
 

Private Attributes

std::shared_ptr< CancellationStatestate_
 

Detailed Description

Cooperative cancellation source paired with CancellationToken.

Definition at line 311 of file thread_pool.H.

Constructor & Destructor Documentation

◆ CancellationSource()

Aleph::CancellationSource::CancellationSource ( )
default

Default constructor.

Member Function Documentation

◆ cancel()

void Aleph::CancellationSource::cancel ( )
inlinenoexcept

Synonym for request_cancel().

Definition at line 334 of file thread_pool.H.

References request_cancel().

◆ request_cancel()

void Aleph::CancellationSource::request_cancel ( )
inlinenoexcept

Request cancellation for all derived tokens.

Definition at line 327 of file thread_pool.H.

References state_.

Referenced by cancel(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ reset()

void Aleph::CancellationSource::reset ( )
inline

Reset the source so future tokens observe a fresh state.

Definition at line 343 of file thread_pool.H.

References state_.

◆ stop_requested()

bool Aleph::CancellationSource::stop_requested ( ) const
inlinenoexcept

Return true if cancellation has already been requested.

Definition at line 337 of file thread_pool.H.

References state_.

◆ token()

CancellationToken Aleph::CancellationSource::token ( ) const
inlinenoexcept

Return a token observing this source.

Definition at line 321 of file thread_pool.H.

References state_.

Referenced by example_structured_concurrency(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

Member Data Documentation

◆ state_

std::shared_ptr<CancellationState> Aleph::CancellationSource::state_
private
Initial value:
=
std::make_shared<CancellationState>()

Definition at line 313 of file thread_pool.H.

Referenced by request_cancel(), reset(), stop_requested(), and token().


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