From e833129983920148f35f191dbed6f02d5197a124 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Tue, 18 Jun 2013 14:06:57 +1000 Subject: [PATCH] Added guards incase of multiple calls --- libs/common/network_queue.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/common/network_queue.cpp b/libs/common/network_queue.cpp index 80758f8..774d3ba 100644 --- a/libs/common/network_queue.cpp +++ b/libs/common/network_queue.cpp @@ -32,6 +32,9 @@ static int networkQueue(void*) { } void BeginQueueThread() { + if (running) { + return; + } running = true; if (!(queueThread = SDL_CreateThread(networkQueue, nullptr))) { throw(std::runtime_error("Failed to create the network thread")); @@ -39,12 +42,18 @@ void BeginQueueThread() { } void EndQueueThread() { + if (!running) { + return; + } running = false; SDL_WaitThread(queueThread, nullptr); queueThread = nullptr; } void KillQueueThread() { + if (!running) { + return; + } running = false; SDL_KillThread(queueThread); queueThread = nullptr;