From 1ed8351af1a3227973dbe8e2c0da214addce4da5 Mon Sep 17 00:00:00 2001 From: mcmartin Date: Sat, 12 Jan 2008 06:18:05 +0000 Subject: [PATCH] Fixed a rare race condition triggered when a thread is dequeued while another is having its name checked git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2902 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/libs/threads/sdl/sdlthreads.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sc2/src/sc2code/libs/threads/sdl/sdlthreads.c b/sc2/src/sc2code/libs/threads/sdl/sdlthreads.c index df87f18e1..a3274b0ad 100644 --- a/sc2/src/sc2code/libs/threads/sdl/sdlthreads.c +++ b/sc2/src/sc2code/libs/threads/sdl/sdlthreads.c @@ -141,8 +141,8 @@ UnQueueThread (TrueThread thread) { volatile TrueThread *ptr; - ptr = &threadQueue; SDL_mutexP (threadQueueMutex); + ptr = &threadQueue; while (*ptr != thread) { #ifdef DEBUG_THREADS @@ -166,8 +166,8 @@ FindThreadInfo (Uint32 threadID) { TrueThread ptr; - ptr = threadQueue; SDL_mutexP (threadQueueMutex); + ptr = threadQueue; while (ptr) { if (SDL_GetThreadID (ptr->native) == threadID)