Android: Fix emuthread management to exit cleanly without hanging. Helps with task switching on Android.

This commit is contained in:
Henrik Rydgård 2018-02-07 13:11:43 +01:00
parent b3a09791b1
commit 7f30037e45
8 changed files with 72 additions and 17 deletions

View file

@ -54,6 +54,9 @@ enum EmuThreadStatus : int {
void EmuThreadFunc();
void RenderThreadFunc();
// On most other platforms, we let the main thread become the render thread and
// start a separate emu thread from that, if needed. Should probably switch to that
// to make it the same on all platforms.
void EmuThread_Start(bool separateRenderThread) {
std::lock_guard<std::mutex> guard(emuThreadLock);
emuThread = std::thread(&EmuThreadFunc);
@ -218,7 +221,7 @@ void EmuThreadFunc() {
if (g_Config.bBrowse)
PostMessage(MainWindow::GetHWND(), WM_COMMAND, ID_FILE_LOAD, 0);
Core_EnableStepping(FALSE);
Core_EnableStepping(false);
while (GetUIState() != UISTATE_EXIT) {
// We're here again, so the game quit. Restart Core_Run() which controls the UI.