GLES: Prevent race condition on shutdown.

emuThreadState might become STOPPED before the last frame has been run,
which can cause WaitUntilQueueIdle to hang.

It's simpler just to wait until StopThread() is called, since it now is.
This will line up properly with run_.
This commit is contained in:
Unknown W. Brackets committed 2018-02-11 11:40:11 -08:00
1 parent fcc2b59c57
commit cdf378d20c
4 files changed
+10 -10

No files matched your search

+2 -2
View File
@@ -248,9 +248,9 @@ MainUI::~MainUI()
if (emuThreadState != (int)EmuThreadState::DISABLED) {
ILOG("EmuThreadStop");
EmuThreadStop();
while (emuThreadState != (int)EmuThreadState::STOPPED) {
while (graphicsContext->ThreadFrame()) {
// Need to keep eating frames to allow the EmuThread to exit correctly.
graphicsContext->ThreadFrame();
continue;
}
EmuThreadJoin();
}
+2 -2
View File
@@ -896,9 +896,9 @@ int main(int argc, char *argv[]) {
if (useEmuThread) {
EmuThreadStop();
while (emuThreadState != (int)EmuThreadState::STOPPED) {
while (graphicsContext->ThreadFrame()) {
// Need to keep eating frames to allow the EmuThread to exit correctly.
graphicsContext->ThreadFrame();
continue;
}
EmuThreadJoin();
}
+2 -2
View File
@@ -244,9 +244,9 @@ void MainThreadFunc() {
if (useEmuThread) {
EmuThreadStop();
while (emuThreadState != (int)EmuThreadState::STOPPED) {
while (graphicsContext->ThreadFrame()) {
// Need to keep eating frames to allow the EmuThread to exit correctly.
graphicsContext->ThreadFrame();
continue;
}
EmuThreadJoin();
}
+4 -4
View File
@@ -511,8 +511,8 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_pause(JNIEnv *, jclass) {
extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) {
if (useCPUThread && graphicsContext) {
EmuThreadStop();
while (emuThreadState != (int)EmuThreadState::STOPPED) {
graphicsContext->ThreadFrame();
while (graphicsContext->ThreadFrame()) {
continue;
}
EmuThreadJoin();
}
@@ -546,8 +546,8 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env,
graphicsContext->ThreadEnd();
if (useCPUThread) {
EmuThreadStop();
while (emuThreadState != (int)EmuThreadState::STOPPED) {
graphicsContext->ThreadFrame();
while (graphicsContext->ThreadFrame()) {
continue;
}
EmuThreadJoin();
} else {