Check that mutex is unlocked from the right thread.

git-svn-id: http://yate.null.ro/svn/yate/trunk@1832 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2008-03-21 15:46:04 +00:00
parent 9d6e4c5b4b
commit 3c32ca4eb8
1 changed files with 6 additions and 1 deletions

View File

@ -264,8 +264,13 @@ void MutexPrivate::unlock()
Thread* thr = Thread::current();
if (thr)
thr->m_locks--;
if (!--m_locked)
if (!--m_locked) {
const char* tname = thr ? thr->name() : 0;
if (tname != m_owner)
Debug(DebugFail,"MutexPrivate unlocked by '%s' but owned by '%s' [%p]",
tname,m_owner,this);
m_owner = 0;
}
if (--s_locks < 0)
Debug(DebugFail,"MutexPrivate::locks() is %d [%p]",s_locks,this);
#ifdef _WINDOWS