From c58217116c7355d77717e09430f2fcb2c5185fb7 Mon Sep 17 00:00:00 2001 From: Marco S Hyman Date: Mon, 5 Nov 2001 22:53:29 +0000 Subject: Don't change the state of a thread as a result of a signal that is masked by that thread. This fixes the problem found with the signal regression test. --- lib/libc_r/uthread/uthread_sig.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/libc_r') diff --git a/lib/libc_r/uthread/uthread_sig.c b/lib/libc_r/uthread/uthread_sig.c index 2dae9ce5de2..c13d2050441 100644 --- a/lib/libc_r/uthread/uthread_sig.c +++ b/lib/libc_r/uthread/uthread_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_sig.c,v 1.9 2001/11/02 20:37:20 marc Exp $ */ +/* $OpenBSD: uthread_sig.c,v 1.10 2001/11/05 22:53:28 marc Exp $ */ /* * Copyright (c) 1995-1998 John Birrell * All rights reserved. @@ -271,10 +271,14 @@ void _thread_signal(pthread_t pthread, int sig) { /* - * Flag the signal as pending. It will be dispatched later. + * Flag the signal as pending. It may be dispatched later. */ sigaddset(&pthread->sigpend,sig); + /* skip this thread if signal is masked */ + if (sigismember(&pthread->sigmask, sig)) + return; + /* * Process according to thread state: */ @@ -348,8 +352,7 @@ _thread_signal(pthread_t pthread, int sig) * Only wake up the thread if the signal is unblocked * and there is a handler installed for the signal. */ - if (!sigismember(&pthread->sigmask, sig) && - _thread_sigact[sig - 1].sa_handler != SIG_DFL) { + if (_thread_sigact[sig - 1].sa_handler != SIG_DFL) { /* Change the state of the thread to run: */ PTHREAD_NEW_STATE(pthread,PS_RUNNING); -- cgit v1.2.3