mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-03 11:13:44 +01:00
SDL: Fix emuthread management to exit cleanly without hanging.
This commit is contained in:
1 parent
59d6cc12f2
commit
b3a09791b1
1 file changed
+12
-1
+12
-1
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user