Class of general-purpose executors.
More...
|
static std::string | create_thread_id_string () |
| Create a string of the current thread ID.
|
static std::size_t | get_context_index (std::atomic< std::size_t > &index, std::size_t size) |
| Get the index of context to use.
|
|
| IAsyncExecutor () noexcept=default |
| Constructor.
|
| IExecutor () noexcept=default |
| Constructor.
|
Class of general-purpose executors.
Definition at line 47 of file general_executor.cpp.
◆ GeneralExecutor()
Constructor.
- Parameters
-
[in] | logger | Logger. |
[in] | config | Configuration. |
Definition at line 55 of file general_executor.cpp.
◆ ~GeneralExecutor()
msgpack_rpc::executors::GeneralExecutor::~GeneralExecutor |
( |
| ) |
|
|
inlineoverride |
◆ async_stop_threads_gently()
void msgpack_rpc::executors::GeneralExecutor::async_stop_threads_gently |
( |
| ) |
|
|
inlineprivate |
◆ context()
|
inlineoverridevirtualnoexcept |
◆ create_thread_id_string()
std::string msgpack_rpc::executors::GeneralExecutor::create_thread_id_string |
( |
| ) |
|
|
inlinestaticprivate |
Create a string of the current thread ID.
- Returns
- String of the current thread ID.
Definition at line 239 of file general_executor.cpp.
◆ get_context_index()
std::size_t msgpack_rpc::executors::GeneralExecutor::get_context_index |
( |
std::atomic< std::size_t > & | index, |
|
|
std::size_t | size ) |
|
inlinestaticprivate |
Get the index of context to use.
- Parameters
-
[in] | index | Atomic variable of the index of context. |
[in] | size | Number of context. |
- Returns
- Index of context to use.
Definition at line 252 of file general_executor.cpp.
◆ interrupt_threads()
void msgpack_rpc::executors::GeneralExecutor::interrupt_threads |
( |
| ) |
|
|
inlineprivate |
◆ is_running()
bool msgpack_rpc::executors::GeneralExecutor::is_running |
( |
| ) |
|
|
inlinenodiscardoverridevirtual |
◆ last_exception()
std::exception_ptr msgpack_rpc::executors::GeneralExecutor::last_exception |
( |
| ) |
|
|
inlinenodiscardoverridevirtual |
◆ on_exception()
void msgpack_rpc::executors::GeneralExecutor::on_exception |
( |
std::function< void(std::exception_ptr)> | exception_callback | ) |
|
|
inlineoverridevirtual |
Register a function called when an exception is thrown in asynchronous tasks.
- Parameters
-
[in] | exception_callback | Function called when an exception is thrown in asynchronous tasks. The pointer of the exception is passed as an argument. |
Implements msgpack_rpc::executors::IAsyncExecutor.
Definition at line 123 of file general_executor.cpp.
◆ run_in_thread()
void msgpack_rpc::executors::GeneralExecutor::run_in_thread |
( |
AsioContextType & | context | ) |
|
|
inlineprivate |
Run operations in a thread.
- Parameters
-
[in] | context | Context for this thread. |
Definition at line 209 of file general_executor.cpp.
◆ start()
void msgpack_rpc::executors::GeneralExecutor::start |
( |
| ) |
|
|
inlineoverridevirtual |
Start internal event loops to process asynchronous tasks.
- Note
- Internal processing stops
- when a task throws an exception, which can be retrieved from last_exception function,
- when stop function is called.
Implements msgpack_rpc::executors::IAsyncExecutor.
Definition at line 72 of file general_executor.cpp.
◆ start_threads()
void msgpack_rpc::executors::GeneralExecutor::start_threads |
( |
| ) |
|
|
inlineprivate |
◆ stop()
void msgpack_rpc::executors::GeneralExecutor::stop |
( |
| ) |
|
|
inlineoverridevirtual |
◆ stop_threads()
void msgpack_rpc::executors::GeneralExecutor::stop_threads |
( |
| ) |
|
|
inlineprivate |
◆ callback_context_index_
std::atomic<std::size_t> msgpack_rpc::executors::GeneralExecutor::callback_context_index_ {0} |
|
private |
◆ callbacks_context_thread_pairs_
std::vector<ContextThreadPair> msgpack_rpc::executors::GeneralExecutor::callbacks_context_thread_pairs_ |
|
private |
◆ exception_callbacks_
std::vector<std::function<void(std::exception_ptr)> > msgpack_rpc::executors::GeneralExecutor::exception_callbacks_ {} |
|
private |
◆ exception_callbacks_mutex_
std::mutex msgpack_rpc::executors::GeneralExecutor::exception_callbacks_mutex_ {} |
|
private |
◆ exception_in_thread_
std::exception_ptr msgpack_rpc::executors::GeneralExecutor::exception_in_thread_ {} |
|
private |
◆ exception_in_thread_mutex_
std::mutex msgpack_rpc::executors::GeneralExecutor::exception_in_thread_mutex_ {} |
|
private |
◆ is_started_
std::atomic<bool> msgpack_rpc::executors::GeneralExecutor::is_started_ {false} |
|
private |
◆ is_stopped_
std::atomic<bool> msgpack_rpc::executors::GeneralExecutor::is_stopped_ {false} |
|
private |
◆ logger_
std::shared_ptr<logging::Logger> msgpack_rpc::executors::GeneralExecutor::logger_ |
|
private |
◆ transport_context_index_
std::atomic<std::size_t> msgpack_rpc::executors::GeneralExecutor::transport_context_index_ {0} |
|
private |
◆ transport_context_thread_pairs_
std::vector<ContextThreadPair> msgpack_rpc::executors::GeneralExecutor::transport_context_thread_pairs_ |
|
private |
The documentation for this class was generated from the following file: