mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Thread closing improvements
This commit is contained in:
1
EU07.cpp
1
EU07.cpp
@@ -68,6 +68,7 @@ LONG WINAPI CrashHandler(EXCEPTION_POINTERS *ExceptionInfo)
|
|||||||
MINIDUMP_TYPE dumpType = MINIDUMP_TYPE(MiniDumpWithFullMemory | MiniDumpWithHandleData | MiniDumpWithThreadInfo | MiniDumpWithUnloadedModules | MiniDumpWithIndirectlyReferencedMemory |
|
MINIDUMP_TYPE dumpType = MINIDUMP_TYPE(MiniDumpWithFullMemory | MiniDumpWithHandleData | MiniDumpWithThreadInfo | MiniDumpWithUnloadedModules | MiniDumpWithIndirectlyReferencedMemory |
|
||||||
MiniDumpWithFullMemoryInfo | MiniDumpWithTokenInformation);
|
MiniDumpWithFullMemoryInfo | MiniDumpWithTokenInformation);
|
||||||
|
|
||||||
|
MessageBoxA(nullptr, "Simulator crash occured :(\n", "Simulator crashed :(", MB_ICONERROR);
|
||||||
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, dumpType, &dumpInfo, nullptr, nullptr);
|
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, dumpType, &dumpInfo, nullptr, nullptr);
|
||||||
|
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
|
|||||||
@@ -592,7 +592,7 @@ int eu07_application::run()
|
|||||||
GfxRenderer->SwapBuffers();
|
GfxRenderer->SwapBuffers();
|
||||||
|
|
||||||
if (m_modestack.empty())
|
if (m_modestack.empty())
|
||||||
return 0;
|
break;
|
||||||
|
|
||||||
m_modes[m_modestack.top()]->on_event_poll();
|
m_modes[m_modestack.top()]->on_event_poll();
|
||||||
|
|
||||||
@@ -611,20 +611,21 @@ int eu07_application::run()
|
|||||||
std::this_thread::sleep_for(Global.minframetime - frametime);
|
std::this_thread::sleep_for(Global.minframetime - frametime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Global.applicationQuitOrder = true;
|
// Handled by application.exit
|
||||||
auto it = Global.threads.find("LogService");
|
// Global.applicationQuitOrder = true;
|
||||||
if (it != Global.threads.end())
|
// auto it = Global.threads.find("LogService");
|
||||||
{
|
// if (it != Global.threads.end())
|
||||||
if (it->second.joinable())
|
// {
|
||||||
it->second.join();
|
// if (it->second.joinable())
|
||||||
}
|
// it->second.join();
|
||||||
|
// }
|
||||||
it = Global.threads.find("DiscordRPC");
|
//
|
||||||
if (it != Global.threads.end())
|
// it = Global.threads.find("DiscordRPC");
|
||||||
{
|
// if (it != Global.threads.end())
|
||||||
if (it->second.joinable())
|
// {
|
||||||
it->second.join();
|
// if (it->second.joinable())
|
||||||
}
|
// it->second.join();
|
||||||
|
// }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,20 +658,6 @@ void eu07_application::release_python_lock()
|
|||||||
void eu07_application::exit()
|
void eu07_application::exit()
|
||||||
{
|
{
|
||||||
Global.applicationQuitOrder = true;
|
Global.applicationQuitOrder = true;
|
||||||
auto it = Global.threads.find("LogService");
|
|
||||||
if (it != Global.threads.end())
|
|
||||||
{
|
|
||||||
if (it->second.joinable())
|
|
||||||
it->second.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
it = Global.threads.find("DiscordRPC");
|
|
||||||
if (it != Global.threads.end())
|
|
||||||
{
|
|
||||||
if (it->second.joinable())
|
|
||||||
it->second.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto &mode : m_modes)
|
for (auto &mode : m_modes)
|
||||||
mode.reset();
|
mode.reset();
|
||||||
|
|
||||||
@@ -691,6 +678,20 @@ void eu07_application::exit()
|
|||||||
|
|
||||||
if (!Global.exec_on_exit.empty())
|
if (!Global.exec_on_exit.empty())
|
||||||
system(Global.exec_on_exit.c_str());
|
system(Global.exec_on_exit.c_str());
|
||||||
|
|
||||||
|
auto it = Global.threads.find("LogService");
|
||||||
|
if (it != Global.threads.end())
|
||||||
|
{
|
||||||
|
if (it->second.joinable())
|
||||||
|
it->second.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
it = Global.threads.find("DiscordRPC");
|
||||||
|
if (it != Global.threads.end())
|
||||||
|
{
|
||||||
|
if (it->second.joinable())
|
||||||
|
it->second.join();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void eu07_application::render_ui()
|
void eu07_application::render_ui()
|
||||||
|
|||||||
Reference in New Issue
Block a user