mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 02:47:02 +02:00
emulator: run cleanup handlers on the quick_exit path (#334)
Run() registers KytyClose with atexit(), but Execute() ends the process with std::quick_exit(), which invokes at_quick_exit handlers only. Nothing registered one, so the cleanup never ran and neither did the emergency shutdown handlers that close open guest files and flush the log. Register a quick-exit handler that runs the emergency shutdown. It deliberately skips RuntimeLinker::Clear(): guest threads are still live at that point and tearing the linker down there deadlocks against a thread parked in a condition wait.
This commit is contained in:
@@ -200,6 +200,10 @@ void Run(const RunOptions& options) {
|
||||
int ok = atexit(KytyClose);
|
||||
EXIT_NOT_IMPLEMENTED(ok != 0);
|
||||
|
||||
// Guest threads are still running, so skip KytyClose() and only flush emergency state.
|
||||
ok = at_quick_exit(Common::Subsystems::EmergencyShutdownActive);
|
||||
EXIT_NOT_IMPLEMENTED(ok != 0);
|
||||
|
||||
Libs::LibKernel::FileSystem::Mount(options.app0_dir, "/app0");
|
||||
Libs::LibKernel::FileSystem::Mount(options.app0_dir, "/hostapp");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user