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

Global executor for async operations. More...

#include <thread_pool_executor.h>

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

Public Member Functions

void set_executor (executor_ptr executor)
 Set the global executor.
 
executor_ptr get_executor () const
 Get the global executor.
 
bool has_executor () const
 Check if an executor is configured.
 
void clear_executor ()
 Clear the global executor.
 

Static Public Member Functions

static async_executor_contextinstance ()
 Get the singleton instance.
 

Private Member Functions

 async_executor_context ()=default
 

Private Attributes

executor_ptr executor_ {}
 

Detailed Description

Global executor for async operations.

When set, async operations will use this executor instead of creating individual threads. This improves performance by reusing threads from a pool.

Definition at line 212 of file thread_pool_executor.h.

Constructor & Destructor Documentation

◆ async_executor_context()

kcenon::container::async::async_executor_context::async_executor_context ( )
privatedefault

Member Function Documentation

◆ clear_executor()

void kcenon::container::async::async_executor_context::clear_executor ( )
inline

Clear the global executor.

Definition at line 257 of file thread_pool_executor.h.

258 {
259#ifdef KCENON_HAS_COMMON_SYSTEM
260 executor_ = nullptr;
261#endif
262 }

References executor_.

◆ get_executor()

executor_ptr kcenon::container::async::async_executor_context::get_executor ( ) const
inlinenodiscard

Get the global executor.

Returns
The current executor, or nullptr if not set

Definition at line 237 of file thread_pool_executor.h.

238 {
239 return executor_;
240 }

References executor_.

◆ has_executor()

bool kcenon::container::async::async_executor_context::has_executor ( ) const
inlinenodiscard

Check if an executor is configured.

Definition at line 245 of file thread_pool_executor.h.

246 {
247#ifdef KCENON_HAS_COMMON_SYSTEM
248 return executor_ != nullptr;
249#else
250 return false;
251#endif
252 }

References executor_.

◆ instance()

static async_executor_context & kcenon::container::async::async_executor_context::instance ( )
inlinestatic

Get the singleton instance.

Definition at line 218 of file thread_pool_executor.h.

219 {
221 return instance;
222 }
static async_executor_context & instance()
Get the singleton instance.

References instance().

Referenced by kcenon::container::async::executor_context_guard::executor_context_guard(), instance(), and kcenon::container::async::executor_context_guard::~executor_context_guard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_executor()

void kcenon::container::async::async_executor_context::set_executor ( executor_ptr executor)
inline

Set the global executor.

Parameters
executorThe executor to use for async operations

Definition at line 228 of file thread_pool_executor.h.

229 {
230 executor_ = std::move(executor);
231 }

References executor_.

Referenced by kcenon::container::async::executor_context_guard::executor_context_guard(), and kcenon::container::async::executor_context_guard::~executor_context_guard().

Here is the caller graph for this function:

Member Data Documentation

◆ executor_

executor_ptr kcenon::container::async::async_executor_context::executor_ {}
private

Definition at line 266 of file thread_pool_executor.h.

266{};

Referenced by clear_executor(), get_executor(), has_executor(), and set_executor().


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