Add shutting down / shutdown states to state keeper

This commit is contained in:
Lion Kortlepel
2021-12-07 14:25:04 +01:00
parent 3ee83904a1
commit cd19ae0836
9 changed files with 54 additions and 1 deletions

View File

@@ -23,16 +23,20 @@ TNetwork::TNetwork(TServer& Server, TPPSMonitor& PPSMonitor, TResourceManager& R
});
});
Application::RegisterShutdownHandler([&] {
Application::SetSubsystemStatus("UDPNetwork", Application::Status::ShuttingDown);
if (mUDPThread.joinable()) {
mShutdown = true;
mUDPThread.detach();
}
Application::SetSubsystemStatus("UDPNetwork", Application::Status::Shutdown);
});
Application::RegisterShutdownHandler([&] {
Application::SetSubsystemStatus("TCPNetwork", Application::Status::ShuttingDown);
if (mTCPThread.joinable()) {
mShutdown = true;
mTCPThread.detach();
}
Application::SetSubsystemStatus("TCPNetwork", Application::Status::Shutdown);
});
mTCPThread = std::thread(&TNetwork::TCPServerMain, this);
mUDPThread = std::thread(&TNetwork::UDPServerMain, this);