Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
Loading...
Searching...
No Matches
kcenon::container::async::executor_context_guard Class Reference

RAII guard for setting executor context. More...

#include <thread_pool_executor.h>

Collaboration diagram for kcenon::container::async::executor_context_guard:
Collaboration graph

Public Member Functions

 executor_context_guard (executor_ptr executor)
 
 ~executor_context_guard ()
 
 executor_context_guard (const executor_context_guard &)=delete
 
executor_context_guardoperator= (const executor_context_guard &)=delete
 

Private Attributes

executor_ptr previous_
 

Detailed Description

RAII guard for setting executor context.

Sets the executor on construction and restores the previous executor on destruction.

{
executor_context_guard guard(my_executor);
// All async operations in this scope use my_executor
auto result = co_await container.serialize_async();
}
// Previous executor restored
RAII guard for setting executor context.

Definition at line 284 of file thread_pool_executor.h.

Constructor & Destructor Documentation

◆ executor_context_guard() [1/2]

kcenon::container::async::executor_context_guard::executor_context_guard ( executor_ptr executor)
inlineexplicit

Definition at line 287 of file thread_pool_executor.h.

289 {
290 async_executor_context::instance().set_executor(std::move(executor));
291 }
void set_executor(executor_ptr executor)
Set the global executor.
static async_executor_context & instance()
Get the singleton instance.

References kcenon::container::async::async_executor_context::instance(), and kcenon::container::async::async_executor_context::set_executor().

Here is the call graph for this function:

◆ ~executor_context_guard()

kcenon::container::async::executor_context_guard::~executor_context_guard ( )
inline

◆ executor_context_guard() [2/2]

kcenon::container::async::executor_context_guard::executor_context_guard ( const executor_context_guard & )
delete

Member Function Documentation

◆ operator=()

executor_context_guard & kcenon::container::async::executor_context_guard::operator= ( const executor_context_guard & )
delete

Member Data Documentation

◆ previous_

executor_ptr kcenon::container::async::executor_context_guard::previous_
private

Definition at line 302 of file thread_pool_executor.h.

Referenced by ~executor_context_guard().


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