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) {