mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-17 16:30:30 +02:00
Rework the shutdown logic in the OpenGL backend. Eliminated race conditions.
This commit is contained in:
1 parent
b813a6c30f
commit
9218fe9b59
26 files changed
+158
-200
No files matched your search
@@ -100,9 +100,6 @@ static void EmuThreadFunc(GraphicsContext *graphicsContext) {
|
||||
emuThreadState = (int)EmuThreadState::STOPPED;
|
||||
|
||||
NativeShutdownGraphics();
|
||||
|
||||
// Ask the main thread to stop. This prevents a hang on a race condition.
|
||||
graphicsContext->StopThread();
|
||||
}
|
||||
|
||||
static void EmuThreadStart(GraphicsContext *graphicsContext) {
|
||||
@@ -277,7 +274,7 @@ void MainThreadFunc() {
|
||||
|
||||
if (useEmuThread) {
|
||||
while (emuThreadState != (int)EmuThreadState::DISABLED) {
|
||||
graphicsContext->ThreadFrame();
|
||||
graphicsContext->ThreadFrame(true);
|
||||
if (GetUIState() == UISTATE_EXIT) {
|
||||
break;
|
||||
}
|
||||
@@ -303,10 +300,10 @@ void MainThreadFunc() {
|
||||
|
||||
if (useEmuThread) {
|
||||
EmuThreadStop();
|
||||
while (graphicsContext->ThreadFrame()) {
|
||||
graphicsContext->ThreadFrameUntilCondition([] {
|
||||
// Need to keep eating frames to allow the EmuThread to exit correctly.
|
||||
continue;
|
||||
}
|
||||
return emuThreadState == (int)EmuThreadState::STOPPED;
|
||||
});
|
||||
EmuThreadJoin();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user