Core: Reset wiimotes/rumble on emu thread instead of main thread

This was causing a race which was crashing the FifoCI runners. The main
thread called Stop() which in turn called ResetAllWiimotes() while the
emu thread was still exiting, also shutting down the Wiimote class.

By shifting the reset to the emu thread, all cleanup operations happen
on the same thread where they were initialized.
This commit is contained in:
Stenzek 2019-12-09 20:06:36 +10:00
parent c602cb2e2f
commit e5485ca499

View File

@ -289,12 +289,6 @@ void Stop() // - Hammertime!
g_video_backend->Video_ExitLoop(); g_video_backend->Video_ExitLoop();
} }
if (_CoreParameter.bWii)
Wiimote::ResetAllWiimotes();
ResetRumble();
} }
void DeclareAsCPUThread() void DeclareAsCPUThread()
@ -534,7 +528,12 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
return; return;
if (init_wiimotes) if (init_wiimotes)
{
Wiimote::ResetAllWiimotes();
Wiimote::Shutdown(); Wiimote::Shutdown();
}
ResetRumble();
Keyboard::Shutdown(); Keyboard::Shutdown();
Pad::Shutdown(); Pad::Shutdown();