From d0805aef37fdd7a7ff7fd38f81911a7f00edb86a Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 17 Jan 2011 08:31:19 +0000 Subject: [PATCH] Fix calling thread::waitfordeath twice in usbgecko/gba git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6871 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/EXI_DeviceGecko.cpp | 21 +++++++-------------- Source/Core/Core/Src/HW/SI_DeviceGBA.cpp | 8 ++------ 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Source/Core/Core/Src/HW/EXI_DeviceGecko.cpp b/Source/Core/Core/Src/HW/EXI_DeviceGecko.cpp index b92e94e567..adeeb49cd4 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceGecko.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceGecko.cpp @@ -17,7 +17,7 @@ #include "EXI_Device.h" #include "EXI_DeviceGecko.h" -//#pragma optimize("",off) + THREAD_RETURN ClientThreadFunc(void *arg) { ((GeckoSockServer*)arg)->ClientThread(); @@ -40,18 +40,16 @@ GeckoSockServer::GeckoSockServer() GeckoSockServer::~GeckoSockServer() { - if (client_running) - { - client_running = false; - clientThread->WaitForDeath(); - } + if (clientThread) + --client_count; + + client_running = false; delete clientThread; clientThread = NULL; - if (--client_count <= 0) + if (client_count <= 0) { server_running = false; - connectionThread->WaitForDeath(); delete connectionThread; connectionThread = NULL; } @@ -95,11 +93,7 @@ bool GeckoSockServer::GetAvailableSock(sf::SocketTCP &sock_to_fill) sock_to_fill = waiting_socks.front(); if (clientThread) { - if (client_running) - { - client_running = false; - clientThread->WaitForDeath(); - } + client_running = false; delete clientThread; clientThread = NULL; } @@ -209,4 +203,3 @@ void CEXIGecko::ImmReadWrite(u32 &_uData, u32 _uSize) break; } } -//#pragma optimize("",on) \ No newline at end of file diff --git a/Source/Core/Core/Src/HW/SI_DeviceGBA.cpp b/Source/Core/Core/Src/HW/SI_DeviceGBA.cpp index 17b069bc85..999a861c22 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGBA.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGBA.cpp @@ -60,12 +60,8 @@ THREAD_RETURN GBAConnectionWaiter(void*) void GBAConnectionWaiter_Shutdown() { server_running = false; - if (connectionThread) - { - connectionThread->WaitForDeath(); - delete connectionThread; - connectionThread = NULL; - } + delete connectionThread; + connectionThread = NULL; } bool GetAvailableSock(sf::SocketTCP& sock_to_fill)