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:
@@ -1,7 +1,7 @@
|
|||||||
SubDir HAIKU_TOP src add-ons kernel debugger invalidate_on_exit ;
|
SubDir HAIKU_TOP src add-ons kernel debugger invalidate_on_exit ;
|
||||||
|
|
||||||
UsePrivateHeaders kernel ;
|
UsePrivateKernelHeaders ;
|
||||||
|
|
||||||
KernelAddon <kdebug>invalidate_on_exit :
|
KernelAddon <kdebug>invalidate_on_exit :
|
||||||
invalidate_on_exit.cpp
|
invalidate_on_exit.cpp
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -2,9 +2,15 @@
|
|||||||
* Copyright 2008, Michael Lotz, [email protected]
|
* Copyright 2008, Michael Lotz, [email protected]
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <kscheduler.h>
|
||||||
|
#include <smp.h>
|
||||||
|
|
||||||
|
|
||||||
static sem_id sRequestSem = -1;
|
static sem_id sRequestSem = -1;
|
||||||
|
|
||||||
@@ -33,6 +39,12 @@ invalidate_loop(void *data)
|
|||||||
static void
|
static void
|
||||||
exit_debugger()
|
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);
|
release_sem_etc(sRequestSem, 1, B_DO_NOT_RESCHEDULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user