From fa76f7e9738f292738b3ac88e48dbba128a805a7 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 15 Sep 2006 10:21:24 +0000 Subject: [PATCH] Added a _threadHoldingMutex = 0; to ReentrantMutex::unlock() to avoid a potential bug with the mutex being aquired by two threads. --- src/osgDB/ReentrantMutex.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osgDB/ReentrantMutex.cpp b/src/osgDB/ReentrantMutex.cpp index f88fb8685..39a6e0a73 100644 --- a/src/osgDB/ReentrantMutex.cpp +++ b/src/osgDB/ReentrantMutex.cpp @@ -51,7 +51,11 @@ int ReentrantMutex::unlock() if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread() && _lockCount>0) { --_lockCount; - if (_lockCount<=0) return Mutex::unlock(); + if (_lockCount<=0) + { + _threadHoldingMutex = 0; + return Mutex::unlock(); + } } return 0; }