* Panic when trying to lock a mutex twice from the same thread. Should make

mutex deadlocks more obvious.
* Fix wrong function name in panic string.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25808 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2008-06-05 21:01:47 +00:00
parent 065ef7eb5f
commit 22b2f0e6b5
+6 -1
View File
@@ -389,7 +389,7 @@ _mutex_lock(mutex* lock, bool threadsLocked)
{
#ifdef KDEBUG
if (!kernel_startup && !threadsLocked && !are_interrupts_enabled()) {
panic("_mutex_unlock(): called with interrupts disabled for lock %p",
panic("_mutex_lock(): called with interrupts disabled for lock %p",
lock);
}
#endif
@@ -400,6 +400,11 @@ _mutex_lock(mutex* lock, bool threadsLocked)
// Might have been released after we decremented the count, but before
// we acquired the spinlock.
#ifdef KDEBUG
if (!kernel_startup && lock->holder == thread_get_current_thread_id()) {
panic("_mutex_lock(): double lock of %p by thread %ld", lock,
lock->holder);
}
if (lock->holder <= 0) {
lock->holder = thread_get_current_thread_id();
return B_OK;