mirror of
https://github.com/libretro/ppsspp.git
synced 2025-01-10 02:23:17 +00:00
SDL: Fix emuthread management to exit cleanly without hanging.
This commit is contained in:
parent
59d6cc12f2
commit
b3a09791b1
@ -432,6 +432,9 @@ static void EmuThreadStart(GraphicsContext *context) {
|
||||
|
||||
static void EmuThreadStop() {
|
||||
emuThreadState = (int)EmuThreadState::QUIT_REQUESTED;
|
||||
}
|
||||
|
||||
static void EmuThreadJoin() {
|
||||
emuThread.join();
|
||||
emuThread = std::thread();
|
||||
}
|
||||
@ -892,7 +895,14 @@ int main(int argc, char *argv[]) {
|
||||
framecount++;
|
||||
}
|
||||
|
||||
EmuThreadStop();
|
||||
if (useEmuThread) {
|
||||
EmuThreadStop();
|
||||
while (emuThreadState != (int)EmuThreadState::STOPPED) {
|
||||
// Need to keep eating frames to allow the EmuThread to exit correctly.
|
||||
graphicsContext->ThreadFrame();
|
||||
}
|
||||
EmuThreadJoin();
|
||||
}
|
||||
|
||||
delete joystick;
|
||||
|
||||
@ -902,6 +912,7 @@ int main(int argc, char *argv[]) {
|
||||
graphicsContext->Shutdown();
|
||||
graphicsContext->ThreadEnd();
|
||||
graphicsContext->ShutdownFromRenderThread();
|
||||
|
||||
NativeShutdown();
|
||||
delete graphicsContext;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user