exit_debugger(): Only try to release the semaphore when no one holds the

scheduler lock. Otherwise we may deadlock.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42182 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2011-06-14 12:48:06 +00:00
parent ec5cc81fa0
commit dc2b8faba2
2 changed files with 14 additions and 2 deletions

View File

@ -1,7 +1,7 @@
SubDir HAIKU_TOP src add-ons kernel debugger invalidate_on_exit ;
UsePrivateHeaders kernel ;
UsePrivateKernelHeaders ;
KernelAddon <kdebug>invalidate_on_exit :
invalidate_on_exit.cpp
;
;

View File

@ -2,9 +2,15 @@
* Copyright 2008, Michael Lotz, mmlr@mlotz.ch
* Distributed under the terms of the MIT License.
*/
#include <debug.h>
#include <signal.h>
#include <kscheduler.h>
#include <smp.h>
static sem_id sRequestSem = -1;
@ -33,6 +39,12 @@ invalidate_loop(void *data)
static void
exit_debugger()
{
// If someone holds the scheduler lock at this point, release_sem_etc()
// will block forever. So avoid that.
if (!try_acquire_spinlock(&gSchedulerLock))
return;
release_spinlock(&gSchedulerLock);
release_sem_etc(sRequestSem, 1, B_DO_NOT_RESCHEDULE);
}