summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libpthread/uthread/uthread_kill.c4
-rw-r--r--lib/libpthread/uthread/uthread_sig.c10
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/libpthread/uthread/uthread_kill.c b/lib/libpthread/uthread/uthread_kill.c
index e39c3320e2f..92702e8b870 100644
--- a/lib/libpthread/uthread/uthread_kill.c
+++ b/lib/libpthread/uthread/uthread_kill.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_kill.c,v 1.10 2003/01/31 04:46:17 marc Exp $ */
+/* $OpenBSD: uthread_kill.c,v 1.11 2003/04/30 17:54:17 marc Exp $ */
/* PUBLIC_DOMAIN <marc@snafu.org> */
#include <errno.h>
@@ -43,6 +43,7 @@ pthread_kill(pthread_t pthread, int sig)
ret = _find_thread(pthread);
if (sig != 0) {
if (_thread_sigact[sig - 1].sa_handler != SIG_IGN) {
+ _thread_kern_sig_defer();
if (pthread->state == PS_SIGWAIT &&
sigismember(pthread->data.sigwait, sig)) {
PTHREAD_NEW_STATE(pthread,PS_RUNNING);
@@ -51,6 +52,7 @@ pthread_kill(pthread_t pthread, int sig)
_thread_kill_siginfo(sig);
_thread_signal(pthread,sig);
}
+ _thread_kern_sig_undefer();
}
}
} else
diff --git a/lib/libpthread/uthread/uthread_sig.c b/lib/libpthread/uthread/uthread_sig.c
index a457af87b50..a7cf1eb9fc4 100644
--- a/lib/libpthread/uthread/uthread_sig.c
+++ b/lib/libpthread/uthread/uthread_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_sig.c,v 1.19 2003/01/31 04:46:17 marc Exp $ */
+/* $OpenBSD: uthread_sig.c,v 1.20 2003/04/30 17:54:17 marc Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -64,6 +64,7 @@ void
_thread_sig_handler(int sig, siginfo_t *info, struct sigcontext * scp)
{
struct pthread *curthread = _get_curthread();
+ int dispatch;
char c;
if (sig == _SCHED_SIGNAL) {
@@ -131,7 +132,10 @@ _thread_sig_handler(int sig, siginfo_t *info, struct sigcontext * scp)
_thread_sys_write(_thread_kern_pipe[1], &c, 1);
_sigq_check_reqd = 1;
} else {
- if (_thread_sig_handle(sig, scp))
+ _queue_signals = 1;
+ dispatch = _thread_sig_handle(sig, scp);
+ _queue_signals = 0;
+ if (dispatch)
_dispatch_signals(scp);
}
}
@@ -160,7 +164,7 @@ _thread_clear_pending(int sig, pthread_t thread)
/*
* Process the given signal. Returns 1 if the signal may be dispatched,
- * otherwise 0.
+ * otherwise 0. Signals MUST be defered when this function is called.
*/
int
_thread_sig_handle(int sig, struct sigcontext * scp)