From 3bf21bf3b6491749da20679afc9d59f89a9bb38c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 19 Nov 2004 20:05:14 +0000 Subject: [PATCH] Added _lockCount>0 check to lock,unlock and trylock to make sure that it is set properly on first time entry. --- src/osgDB/ReentrantMutex.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osgDB/ReentrantMutex.cpp b/src/osgDB/ReentrantMutex.cpp index e4a89b39a..c4e051d99 100644 --- a/src/osgDB/ReentrantMutex.cpp +++ b/src/osgDB/ReentrantMutex.cpp @@ -28,7 +28,7 @@ ReentrantMutex::~ReentrantMutex() int ReentrantMutex::lock() { - if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread()) + if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread() && _lockCount>0) { ++_lockCount; return 0; @@ -47,7 +47,7 @@ int ReentrantMutex::lock() int ReentrantMutex::unlock() { - if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread()) + if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread() && _lockCount>0) { --_lockCount; if (_lockCount<=0) return Mutex::unlock(); @@ -57,7 +57,7 @@ int ReentrantMutex::unlock() int ReentrantMutex::trylock() { - if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread()) + if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread() && _lockCount>0) { ++_lockCount; return 0;