* 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:
@@ -389,7 +389,7 @@ _mutex_lock(mutex* lock, bool threadsLocked)
|
|||||||
{
|
{
|
||||||
#ifdef KDEBUG
|
#ifdef KDEBUG
|
||||||
if (!kernel_startup && !threadsLocked && !are_interrupts_enabled()) {
|
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);
|
lock);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -400,6 +400,11 @@ _mutex_lock(mutex* lock, bool threadsLocked)
|
|||||||
// Might have been released after we decremented the count, but before
|
// Might have been released after we decremented the count, but before
|
||||||
// we acquired the spinlock.
|
// we acquired the spinlock.
|
||||||
#ifdef KDEBUG
|
#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) {
|
if (lock->holder <= 0) {
|
||||||
lock->holder = thread_get_current_thread_id();
|
lock->holder = thread_get_current_thread_id();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user