Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::cancellation_context::guard Class Reference

RAII guard for push/pop operations. More...

#include <enhanced_cancellation_token.h>

Collaboration diagram for kcenon::thread::cancellation_context::guard:
Collaboration graph

Public Member Functions

 guard (enhanced_cancellation_token token)
 Constructs a guard and pushes the token.
 
 ~guard ()
 Destructor pops the token.
 
 guard (const guard &)=delete
 
auto operator= (const guard &) -> guard &=delete
 
 guard (guard &&)=delete
 
auto operator= (guard &&) -> guard &=delete
 

Private Attributes

bool pushed_
 

Detailed Description

RAII guard for push/pop operations.

Definition at line 513 of file enhanced_cancellation_token.h.

Constructor & Destructor Documentation

◆ guard() [1/3]

kcenon::thread::cancellation_context::guard::guard ( enhanced_cancellation_token token)
explicit

Constructs a guard and pushes the token.

Parameters
tokenThe token to push.

Definition at line 628 of file enhanced_cancellation_token.cpp.

629 : pushed_(true)
630 {
631 cancellation_context::push(std::move(token));
632 }
static auto push(enhanced_cancellation_token token) -> void
Pushes a token to the thread-local stack.

References kcenon::thread::cancellation_context::push().

Here is the call graph for this function:

◆ ~guard()

kcenon::thread::cancellation_context::guard::~guard ( )

Destructor pops the token.

Definition at line 634 of file enhanced_cancellation_token.cpp.

635 {
636 if (pushed_)
637 {
639 }
640 }
static auto pop() -> void
Pops a token from the thread-local stack.

References kcenon::thread::cancellation_context::pop().

Here is the call graph for this function:

◆ guard() [2/3]

kcenon::thread::cancellation_context::guard::guard ( const guard & )
delete

◆ guard() [3/3]

kcenon::thread::cancellation_context::guard::guard ( guard && )
delete

Member Function Documentation

◆ operator=() [1/2]

auto kcenon::thread::cancellation_context::guard::operator= ( const guard & ) -> guard &=delete
delete

◆ operator=() [2/2]

auto kcenon::thread::cancellation_context::guard::operator= ( guard && ) -> guard &=delete
delete

Member Data Documentation

◆ pushed_

bool kcenon::thread::cancellation_context::guard::pushed_
private

Definition at line 534 of file enhanced_cancellation_token.h.


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