* 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:
@@ -1322,6 +1322,11 @@ _mutex_lock(mutex *mutex, bool threadsLocked)
|
|||||||
do {
|
do {
|
||||||
status = acquire_sem((sem_id)mutex->waiters);
|
status = acquire_sem((sem_id)mutex->waiters);
|
||||||
} while (status == B_INTERRUPTED);
|
} while (status == B_INTERRUPTED);
|
||||||
|
|
||||||
|
#if KDEBUG
|
||||||
|
if (status == B_OK)
|
||||||
|
mutex->holder = find_thread(NULL);
|
||||||
|
#endif
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1329,6 +1334,9 @@ _mutex_lock(mutex *mutex, bool threadsLocked)
|
|||||||
void
|
void
|
||||||
_mutex_unlock(mutex *mutex, bool threadsLocked)
|
_mutex_unlock(mutex *mutex, bool threadsLocked)
|
||||||
{
|
{
|
||||||
|
#if KDEBUG
|
||||||
|
mutex->holder = -1;
|
||||||
|
#endif
|
||||||
release_sem((sem_id)mutex->waiters);
|
release_sem((sem_id)mutex->waiters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user