Fix calling thread::waitfordeath twice in usbgecko/gba

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6871 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2011-01-17 08:31:19 +00:00
parent fdd56f4621
commit d0805aef37
2 changed files with 9 additions and 20 deletions

View File

@ -17,7 +17,7 @@
#include "EXI_Device.h" #include "EXI_Device.h"
#include "EXI_DeviceGecko.h" #include "EXI_DeviceGecko.h"
//#pragma optimize("",off)
THREAD_RETURN ClientThreadFunc(void *arg) THREAD_RETURN ClientThreadFunc(void *arg)
{ {
((GeckoSockServer*)arg)->ClientThread(); ((GeckoSockServer*)arg)->ClientThread();
@ -40,18 +40,16 @@ GeckoSockServer::GeckoSockServer()
GeckoSockServer::~GeckoSockServer() GeckoSockServer::~GeckoSockServer()
{ {
if (client_running) if (clientThread)
{ --client_count;
client_running = false;
clientThread->WaitForDeath(); client_running = false;
}
delete clientThread; delete clientThread;
clientThread = NULL; clientThread = NULL;
if (--client_count <= 0) if (client_count <= 0)
{ {
server_running = false; server_running = false;
connectionThread->WaitForDeath();
delete connectionThread; delete connectionThread;
connectionThread = NULL; connectionThread = NULL;
} }
@ -95,11 +93,7 @@ bool GeckoSockServer::GetAvailableSock(sf::SocketTCP &sock_to_fill)
sock_to_fill = waiting_socks.front(); sock_to_fill = waiting_socks.front();
if (clientThread) if (clientThread)
{ {
if (client_running) client_running = false;
{
client_running = false;
clientThread->WaitForDeath();
}
delete clientThread; delete clientThread;
clientThread = NULL; clientThread = NULL;
} }
@ -209,4 +203,3 @@ void CEXIGecko::ImmReadWrite(u32 &_uData, u32 _uSize)
break; break;
} }
} }
//#pragma optimize("",on)

View File

@ -60,12 +60,8 @@ THREAD_RETURN GBAConnectionWaiter(void*)
void GBAConnectionWaiter_Shutdown() void GBAConnectionWaiter_Shutdown()
{ {
server_running = false; server_running = false;
if (connectionThread) delete connectionThread;
{ connectionThread = NULL;
connectionThread->WaitForDeath();
delete connectionThread;
connectionThread = NULL;
}
} }
bool GetAvailableSock(sf::SocketTCP& sock_to_fill) bool GetAvailableSock(sf::SocketTCP& sock_to_fill)