$OpenBSD: patch-src_sc2code_libs_threads_sdl_sdlthreads_c,v 1.1 2005/11/05 03:48:41 jolan Exp $
--- src/sc2code/libs/threads/sdl/sdlthreads.c.orig	Wed Jun  9 23:49:02 2004
+++ src/sc2code/libs/threads/sdl/sdlthreads.c	Fri Nov  4 19:34:04 2005
@@ -547,7 +547,7 @@ LockRecursiveMutex_SDL (RecursiveMutex v
 {
 	RecM *mtx = (RecM *)val;
 	Uint32 thread_id = SDL_ThreadID();
-	if (mtx->thread_id != thread_id)
+	if (!mtx->locks || mtx->thread_id != thread_id)
 	{
 #ifdef TRACK_CONTENTION
 		if (mtx->thread_id && (mtx->syncClass & TRACK_CONTENTION_CLASSES))
@@ -567,7 +567,7 @@ UnlockRecursiveMutex_SDL (RecursiveMutex
 {
 	RecM *mtx = (RecM *)val;
 	Uint32 thread_id = SDL_ThreadID();
-	if (mtx->thread_id != thread_id)
+	if (!mtx->locks || mtx->thread_id != thread_id)
 	{
 #ifdef NAMED_SYNCHRO
 		fprintf (stderr, "'%s' attempted to unlock %s when it didn't hold it\n", MyThreadName (), mtx->name);
