fix(gui): quit when emu thread exits first

This commit is contained in:
2023-12-15 02:35:58 -06:00
parent 203971c91a
commit d097dcc2f5
4 changed files with 14 additions and 23 deletions

View File

@@ -95,7 +95,7 @@ pub const Gui = struct {
}
const RunOptions = struct {
sync: Synchro,
sync: *Synchro,
tracker: ?*FpsTracker = null,
cpu: *Arm7tdmi,
scheduler: *Scheduler,
@@ -127,7 +127,7 @@ pub const Gui = struct {
emu_loop: while (true) {
// Outside of `SDL.SDL_QUIT` below, the DearImgui UI might signal that the program
// should exit, in which case we should also handle this
if (self.state.should_quit) break :emu_loop;
if (self.state.should_quit or sync.should_quit.load(.Monotonic)) break :emu_loop;
var event: SDL.SDL_Event = undefined;
while (SDL.SDL_PollEvent(&event) != 0) {