Start the subsystem's processing/event loops.
Begins active processing. After this call, the subsystem should be actively responding to callbacks and processing data according to its domain requirements.
66{
69 "Cannot start NetworkSubsystem: not initialized");
70 return;
71 }
72
74 return;
75 }
76
77 {
79 for (
auto& [transport, backend] :
m_backends) {
80 backend->start();
81 }
82 }
83
84 m_work_guard = std::make_unique<asio::executor_work_guard<asio::io_context::executor_type>>(
86
87 m_io_thread = std::jthread([
this](
const std::stop_token& token) {
88 while (!token.stop_requested()) {
89 try {
90 m_io_context->run();
91 break;
92 } catch (const std::exception& e) {
94 "IO context exception: {}", e.what());
95 }
96 }
97
99 "Network IO thread exiting");
100 });
101
103
105 "Network Subsystem started");
106}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::unique_ptr< asio::io_context > m_io_context
std::shared_mutex m_backends_mutex
std::unique_ptr< asio::executor_work_guard< asio::io_context::executor_type > > m_work_guard
std::atomic< bool > m_ready
std::unordered_map< NetworkTransport, std::unique_ptr< INetworkBackend > > m_backends
std::atomic< bool > m_running
@ Init
Engine/subsystem initialization.
@ Core
Core engine, backend, subsystems.