From d6c0d5b977f29560fba385a31d45c065aa8a5928 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Tue, 3 Feb 2009 04:03:56 +0000 Subject: [PATCH] Wiimote: Fixed semi-frequent hanging that would occur when closing the configuration window git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2080 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp index 2da283d5eb..c13062853a 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp @@ -480,12 +480,18 @@ void DoState(void* ptr, int mode) {} void Shutdown(void) { - g_Shutdown = true; + // Stop the loop in the thread + g_Shutdown = true; + + // Sleep this thread to wait for activity in g_pReadThread to stop entirely + Sleep(100); // Stop the thread if (g_pReadThread != NULL) { - g_pReadThread->WaitForDeath(); + // This sometimes hangs for some reason so I'm trying to disable it + // It seemed to hang in WaitForSingleObject(), but I don't know why + //g_pReadThread->WaitForDeath(); delete g_pReadThread; g_pReadThread = NULL; }