From f75dc555fdd6ac58c8b5b6c0f908ba8d2897a8a8 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 25 Feb 2005 14:20:47 +0000 Subject: [PATCH] * handle_signals(): If a SIGKILL[THR] is pending, ignore other signal. * Added is_kill_signal_pending(). Can anyone tell me why the compiler complains about a missing previous prototype for it? is included, and when only preprocessing the file, the prototype is clearly there. I'm clueless. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11488 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/signal.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/kernel/core/signal.c b/src/kernel/core/signal.c index b4a1f0c503..37463d74dd 100644 --- a/src/kernel/core/signal.c +++ b/src/kernel/core/signal.c @@ -71,11 +71,11 @@ handle_signals(struct thread *thread, cpu_status *state) int i, sig, global_resched = 0; struct sigaction *handler; - // Check, if the thread shall stop for debugging. It will never stop, if - // a SIGKILL[THR] signal is pending. - if (!(signalMask & (1 << (SIGKILL - 1))) - && !(signalMask & (1 << (SIGKILLTHR - 1))) - && thread->debug_info.flags & B_THREAD_DEBUG_STOP) { + // If SIGKILL[THR] are pending, we ignore other signals. + // Otherwise check, if the thread shall stop for debugging. + if (signalMask & KILL_SIGNALS) { + signalMask &= KILL_SIGNALS; + } else if (thread->debug_info.flags & B_THREAD_DEBUG_STOP) { RELEASE_THREAD_LOCK(); restore_interrupts(*state); @@ -200,6 +200,24 @@ handle_signals(struct thread *thread, cpu_status *state) } +bool +is_kill_signal_pending() +{ + bool result; + struct thread *thread = thread_get_current_thread(); + + cpu_status state = disable_interrupts(); + GRAB_THREAD_LOCK(); + + result = (thread->sig_pending & KILL_SIGNALS); + + RELEASE_THREAD_LOCK(); + restore_interrupts(state); + + return result; +} + + static status_t deliver_signal(struct thread *thread, uint signal, uint32 flags) {