Fix race condition where update_gfx could be called after renderer shutdown (#98)

This commit is contained in:
Wiseguy 2025-04-06 19:42:15 -04:00 committed by GitHub
parent db1b1a1082
commit 8506c1b588
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View file

@ -502,6 +502,7 @@ bool ultramodern::is_game_started() {
}
std::atomic_bool exited = false;
moodycamel::LightweightSemaphore graphics_shutdown_ready;
void ultramodern::quit() {
exited.store(true);
@ -763,6 +764,8 @@ void recomp::start(
}
}
graphics_shutdown_ready.signal();
game_thread.join();
ultramodern::join_event_threads();
ultramodern::join_thread_cleaner_thread();

View file

@ -105,6 +105,7 @@ uint64_t total_vis = 0;
extern std::atomic_bool exited;
extern moodycamel::LightweightSemaphore graphics_shutdown_ready;
void set_dummy_vi();
@ -318,6 +319,7 @@ void gfx_thread_func(uint8_t* rdram, moodycamel::LightweightSemaphore* thread_re
}
}
graphics_shutdown_ready.wait();
renderer_context->shutdown();
}