26 context_name_{context_name},
31 std::unique_lock<std::mutex> lck(mutex_);
32 while (!exit_request_) {
34 cond_var_.wait(lck, [
this]() {
return exit_request_ || running_; });
39 io_context_.restart();
56 std::lock_guard<std::mutex> lock{
mutex_};
62 std::lock_guard<std::mutex> lock{
mutex_};
void DeInitialize() noexcept
De-initialize the context.
boost::asio::io_context Context
Type alias for boost context.
std::atomic_bool exit_request_
Flag to terminate the thread.
std::mutex mutex_
mutex to lock critical section
void Initialize() noexcept
Initialize the context.
IoContext() noexcept
Default constructs an instance of IoContext.
Context io_context_
boost io context
~IoContext() noexcept
Destruct an instance of IoContext.
Context & GetContext() noexcept
Function to get the io context reference.
utility::thread::Thread thread_
The thread itself.
std::condition_variable cond_var_
Conditional variable to block the thread.
std::atomic_bool running_
Flag to start the thread.
void Join() noexcept
Function to join the running thread.