mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 15:49:25 +01:00
Join the emu thread in Core::Stop. Get rid of Core::Shutdown which did that before.
Core::Shutdown was only called on app exit, yet the emu thread exits whenever emulation stops; if you launched a new game it would just join via the destructor when s_emu_thread was set to a new thread. (Incidentally, the destructor also makes explicitly joining on app exit rather pointless.) Because the GUI thread wasn't waiting for the CPU thread to fully shut down, Core::IsRunning would remain true briefly after CFrame::DoStop which, given Dolphin's penchant for accessing variables belonging to other threads, can only mean trouble... In my case, because the previous commit caused UpdateGUI, which is called at the end of DoStop, to call PauseAndLock, which checks IsRunning, pressing stop at the right time would cause strange behavior.
This commit is contained in:
parent
e000aaaf5d
commit
ba664b3293
@ -267,6 +267,8 @@ void Stop() // - Hammertime!
|
||||
|
||||
g_video_backend->Video_ExitLoop();
|
||||
}
|
||||
if (s_emu_thread.joinable())
|
||||
s_emu_thread.join();
|
||||
}
|
||||
|
||||
static void DeclareAsCPUThread()
|
||||
@ -793,12 +795,6 @@ void UpdateTitle()
|
||||
Host_UpdateTitle(SMessage);
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
if (s_emu_thread.joinable())
|
||||
s_emu_thread.join();
|
||||
}
|
||||
|
||||
void SetOnStoppedCallback(StoppedCallbackFunc callback)
|
||||
{
|
||||
s_on_stopped_callback = callback;
|
||||
|
@ -40,7 +40,6 @@ enum EState
|
||||
|
||||
bool Init();
|
||||
void Stop();
|
||||
void Shutdown();
|
||||
|
||||
std::string StopMessage(bool, std::string);
|
||||
|
||||
|
@ -371,7 +371,6 @@ void DolphinApp::OnEndSession(wxCloseEvent& event)
|
||||
|
||||
int DolphinApp::OnExit()
|
||||
{
|
||||
Core::Shutdown();
|
||||
UICommon::Shutdown();
|
||||
|
||||
delete m_locale;
|
||||
|
@ -343,7 +343,6 @@ int main(int argc, char* argv[])
|
||||
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
||||
updateMainFrameEvent.Wait();
|
||||
|
||||
Core::Shutdown();
|
||||
platform->Shutdown();
|
||||
UICommon::Shutdown();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user