* Now also sets the mutex::holder field (only present when KDEBUG is defind),

to make ASSERT_LOCKED_MUTEX() work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28513 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-11-05 11:54:09 +00:00
parent ddd20af422
commit 2ecc2162bb

View File

@ -1322,6 +1322,11 @@ _mutex_lock(mutex *mutex, bool threadsLocked)
do {
status = acquire_sem((sem_id)mutex->waiters);
} while (status == B_INTERRUPTED);
#if KDEBUG
if (status == B_OK)
mutex->holder = find_thread(NULL);
#endif
return status;
}
@ -1329,6 +1334,9 @@ _mutex_lock(mutex *mutex, bool threadsLocked)
void
_mutex_unlock(mutex *mutex, bool threadsLocked)
{
#if KDEBUG
mutex->holder = -1;
#endif
release_sem((sem_id)mutex->waiters);
}