Fix Recursive Mutexes to handle ThreadID==0 (bug #779)

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1884 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2005-09-27 09:02:54 +00:00
parent 5b0fb32b68
commit 04cfa2feba
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.5:
- Fixed Recursive Mutexes to still work even if the ThreadID is 0
(bug 779) - Michael
- Permit independent selection of graphics driver and resolution in
setup menu - Michael
- Changed comm subtitle caching to use own context instead of
@@ -547,7 +547,7 @@ LockRecursiveMutex_SDL (RecursiveMutex val)
{
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 val)
{
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);