Fixed deadlock when mutex lock count is negative so it aborts out properly.

git-svn-id: http://yate.null.ro/svn/yate/trunk@2287 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2008-10-24 13:46:17 +00:00
parent 2ff025e436
commit 90711d6097
1 changed files with 4 additions and 2 deletions

View File

@ -273,10 +273,12 @@ void MutexPrivate::unlock()
tname,m_owner,this);
m_owner = 0;
}
if (--s_locks < 0) {
int locks = --s_locks;
if (locks < 0) {
// this is very very bad - abort right now
abortOnBug(true);
Debug(DebugFail,"MutexPrivate::locks() is %d [%p]",s_locks,this);
s_locks = 0;
Debug(DebugFail,"MutexPrivate::locks() is %d [%p]",locks,this);
}
#ifdef _WINDOWS
::ReleaseMutex(m_mutex);