Merge pull request #2538 from Armada651/thread-revert

Revert "Join the emu thread in Core::Stop. Get rid of Core::Shutdown which did that before."
This commit is contained in:
Jules Blok 2015-07-25 13:02:04 +02:00
commit fbd5bb815c
5 changed files with 17 additions and 3 deletions

View file

@ -162,7 +162,7 @@ void DisplayMessage(const std::string& message, int time_in_ms)
bool IsRunning()
{
return (GetState() != CORE_UNINITIALIZED) || s_hardware_initialized;
return (GetState() != CORE_UNINITIALIZED || s_hardware_initialized) && !s_is_stopping;
}
bool IsRunningAndStarted()
@ -273,8 +273,6 @@ void Stop() // - Hammertime!
g_video_backend->Video_ExitLoop();
}
if (s_emu_thread.joinable())
s_emu_thread.join();
}
static void DeclareAsCPUThread()
@ -829,6 +827,18 @@ void UpdateTitle()
Host_UpdateTitle(SMessage);
}
void Shutdown()
{
// During shutdown DXGI expects us to handle some messages on the UI thread.
// Therefore we can't immediately block and wait for the emu thread to shut
// down, so we join the emu thread as late as possible when the UI has already
// shut down.
// For more info read "DirectX Graphics Infrastructure (DXGI): Best Practices"
// on MSDN.
if (s_emu_thread.joinable())
s_emu_thread.join();
}
void SetOnStoppedCallback(StoppedCallbackFunc callback)
{
s_on_stopped_callback = callback;

View file

@ -39,6 +39,7 @@ enum EState
bool Init();
void Stop();
void Shutdown();
std::string StopMessage(bool, const std::string&);

View file

@ -370,6 +370,7 @@ void DolphinApp::OnEndSession(wxCloseEvent& event)
int DolphinApp::OnExit()
{
Core::Shutdown();
UICommon::Shutdown();
delete m_locale;

View file

@ -627,6 +627,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *
updateMainFrameEvent.Wait();
}
Core::Shutdown();
UICommon::Shutdown();
ANativeWindow_release(surf);

View file

@ -358,6 +358,7 @@ int main(int argc, char* argv[])
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
updateMainFrameEvent.Wait();
Core::Shutdown();
platform->Shutdown();
UICommon::Shutdown();