mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 14:59:43 +01:00
fix(app): the log written to the end of the closing, each step of it with its time; the Discord thread idle outside the driver mode
The log service stopped with applicationQuitOrder, so whatever was logged while the simulator closed was lost; it now runs until StopLogService() and writes out what came before. The closing logs each of its steps with the time since it began, to tell where a closing that hangs stops. Outside the driver mode the Discord thread spun a core in its loop, it now sleeps a second between the checks.
This commit is contained in:
@@ -270,7 +270,11 @@ void eu07_application::DiscordRPCService()
|
||||
}
|
||||
|
||||
if (currentMode != mode::driver)
|
||||
{
|
||||
// the editor and the other modes: nothing to tell, without spinning a core on it
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Discord RPC updater
|
||||
if (simulation::is_ready)
|
||||
@@ -690,19 +694,29 @@ void eu07_application::release_python_lock()
|
||||
void eu07_application::exit()
|
||||
{
|
||||
Global.applicationQuitOrder = true;
|
||||
// each step of the closing in the log, to tell from it where a closing that hangs stops
|
||||
auto const closing{std::chrono::steady_clock::now()};
|
||||
auto const step = [&](char const *What) {
|
||||
WriteLog(std::string{"Closing: "} + What + " at " + std::to_string(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - closing).count()) + " ms");
|
||||
};
|
||||
step("the modes");
|
||||
for (auto &mode : m_modes)
|
||||
mode.reset();
|
||||
|
||||
step("the renderer");
|
||||
GfxRenderer->Shutdown();
|
||||
m_network.reset();
|
||||
|
||||
// SafeDelete( simulation::Train );
|
||||
step("the scenery");
|
||||
SafeDelete(simulation::Region);
|
||||
|
||||
step("the ui and the python workers");
|
||||
ui_layer::shutdown();
|
||||
|
||||
// the python workers detach their GL context on the way out, so they have to be done before the windows they use are destroyed
|
||||
m_taskqueue.exit();
|
||||
step("the windows");
|
||||
for (auto *window : m_windows)
|
||||
{
|
||||
glfwDestroyWindow(window);
|
||||
@@ -713,6 +727,8 @@ void eu07_application::exit()
|
||||
if (!Global.exec_on_exit.empty())
|
||||
system(Global.exec_on_exit.c_str());
|
||||
|
||||
step("done");
|
||||
StopLogService();
|
||||
auto it = Global.threads.find("LogService");
|
||||
if (it != Global.threads.end())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user