From ea761fb5bb94f4e5c05c5af48e073b05b1863b0b Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Mon, 17 Jun 2013 15:49:57 +1000 Subject: [PATCH] Fixed the bug running was false when it was checked in networkQueue(), so the thread was ending early. --- libs/common/network_queue.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libs/common/network_queue.cpp b/libs/common/network_queue.cpp index 6582532..4253dec 100644 --- a/libs/common/network_queue.cpp +++ b/libs/common/network_queue.cpp @@ -7,7 +7,6 @@ #include #include -#include static SDL_sem* lock = SDL_CreateSemaphore(1); static SDL_Thread* queueThread = nullptr; @@ -18,8 +17,6 @@ static bool running = false; static int networkQueue(void*) { UDPNetworkUtility* netUtil = ServiceLocator::Get(); - //this line is the fix for the quirk -// std::cout << "thread running" << std::endl; while(running) { SDL_SemWait(lock); while(netUtil->Receive()) { @@ -34,10 +31,10 @@ static int networkQueue(void*) { } void BeginQueueThread() { + running = true; if (!(queueThread = SDL_CreateThread(networkQueue, nullptr))) { throw(std::runtime_error("Failed to create the network thread")); } - running = true; } void EndQueueThread() {