Skip to content

fix(minarch): exit cleanly on SIGINT and SIGTERM so saves and teardown run - #904

Open
Pobega wants to merge 1 commit into
LoveRetro:mainfrom
Pobega:fix/minarch-signal-cleanup
Open

Pobega wants to merge 1 commit into
LoveRetro:mainfrom
Pobega:fix/minarch-signal-cleanup

Conversation

@Pobega

@Pobega Pobega commented Nov 19, 2026

Copy link
Copy Markdown

Previously minarch had no SIGINT/SIGTERM handler, so external shutdowns (such as reboot_next, killall, or Ctrl+C) terminated the process mid-frame without flushing SRAM/saves, closing RetroAchievements, or tearing down video/audio/GL state.

Handle SIGINT and SIGTERM by setting quit = 1 (using sig_atomic_t) and check quit in the menu, options, binding, and achievements loops so paused sessions unwind through the normal teardown path instead of hanging until SIGKILL.

Previously minarch had no SIGINT/SIGTERM handler, so external shutdowns
(such as reboot_next, killall, or Ctrl+C) terminated the process mid-frame
without flushing SRAM/saves, closing RetroAchievements, or tearing down
video/audio/GL state.

Handle SIGINT and SIGTERM by setting quit = 1 (using sig_atomic_t) and
check quit in the menu, options, binding, and achievements loops so paused
sessions unwind through the normal teardown path instead of hanging until
SIGKILL.
@Pobega

Pobega commented Nov 19, 2026

Copy link
Copy Markdown
Author

I ran into this while testing the HW render branch, trying to SIGINT/SIGKILL didn't kill the emulator over ADB (PLAT_pollInput ignores SDL_QUIT events).

This allows someone to shutdown the emulator gracefully rather than having to kill -9, and lets RA_Quit, Core_quit and GFX_quit run their teardowns properly.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant