summaryrefslogtreecommitdiff
path: root/lib/libc_r
diff options
context:
space:
mode:
authorMarco S Hyman <marc@cvs.openbsd.org>2001-11-05 22:53:29 +0000
committerMarco S Hyman <marc@cvs.openbsd.org>2001-11-05 22:53:29 +0000
commitc58217116c7355d77717e09430f2fcb2c5185fb7 (patch)
treee2ae25f29decd3393805dceae86fa4fea8738f20 /lib/libc_r
parent5778fe183968a4d7c76f620b6bf1f076b1cef360 (diff)
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.
Diffstat (limited to 'lib/libc_r')
-rw-r--r--lib/libc_r/uthread/uthread_sig.c11
1 files changed, 7 insertions, 4 deletions
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 <jb@cimlogic.com.au>
* 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);