2#ifndef _KURLYK_SIMPLE_WEB_SOCKET_WORKER_HPP_INCLUDED
3#define _KURLYK_SIMPLE_WEB_SOCKET_WORKER_HPP_INCLUDED
42 m_future = std::async(std::launch::async,
80# ifdef ASIO_STANDALONE
81 using work_guard_t = asio::executor_work_guard<asio::io_context::executor_type>;
83 using work_guard_t = boost::asio::executor_work_guard<boost::asio::io_context::executor_type>;
103# ifdef ASIO_STANDALONE
boost::asio::executor_work_guard< boost::asio::io_context::executor_type > work_guard_t
io_context_t m_io_context
~SimpleWebSocketWorker()
Private destructor.
SimpleWebSocketWorker & operator=(const SimpleWebSocketWorker &)=delete
work_guard_t m_work_guard
void notify()
Notifies the worker to check for pending tasks.
void stop()
Stops the worker thread and waits for it to finish.
SimpleWebSocketWorker(const SimpleWebSocketWorker &)=delete
void start()
Starts the worker thread if it is not already running.
std::condition_variable m_notify_condition
Condition variable for notifying worker.
bool m_is_worker_started
Flag indicating if worker is started.
bool m_notify
Flag indicating if notification is pending.
static SimpleWebSocketWorker & get_instance()
Get the singleton instance of SimpleWebSocketWorker.
SimpleWebSocketWorker()
Private constructor to prevent instantiation.
std::shared_ptr< SimpleWeb::io_context > io_context_t
std::mutex m_notify_mutex
Mutex for notifying worker.
std::shared_future< void > m_future
std::shared_ptr< SimpleWeb::io_context > get_io_context()
Provides access to the I/O context for WebSocket operations.
std::atomic< bool > m_shutdown
std::mutex m_is_worker_started_mutex
Mutex for controlling worker start.
Primary namespace for the Kurlyk library, encompassing initialization, request management,...
Enables use of ClientError with std::error_code.