aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Evans <jasone@FreeBSD.org>2000-01-20 04:46:52 +0000
committerJason Evans <jasone@FreeBSD.org>2000-01-20 04:46:52 +0000
commitadbd6ee028c873423cef93372c381dae9f72fbbd (patch)
tree24e227ba9505768fd84305e0d36f27820ba33cef
parented25321907f057ad8bb4538de167bba84a25f49d (diff)
downloadsrc-adbd6ee028c873423cef93372c381dae9f72fbbd.tar.gz
src-adbd6ee028c873423cef93372c381dae9f72fbbd.zip
Do signal deferral for pthread_kill() as it was done in the old days.
Submitted by: deischen
Notes
Notes: svn path=/head/; revision=56310
-rw-r--r--lib/libc_r/uthread/pthread_private.h5
-rw-r--r--lib/libc_r/uthread/uthread_kern.c8
-rw-r--r--lib/libc_r/uthread/uthread_sig.c23
-rw-r--r--lib/libkse/thread/thr_kern.c8
-rw-r--r--lib/libkse/thread/thr_private.h5
-rw-r--r--lib/libkse/thread/thr_sig.c23
-rw-r--r--lib/libpthread/thread/thr_kern.c8
-rw-r--r--lib/libpthread/thread/thr_private.h5
-rw-r--r--lib/libpthread/thread/thr_sig.c23
9 files changed, 18 insertions, 90 deletions
diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h
index 8bc2d3fbcae8..560ea44d6145 100644
--- a/lib/libc_r/uthread/pthread_private.h
+++ b/lib/libc_r/uthread/pthread_private.h
@@ -572,11 +572,6 @@ struct pthread {
sigset_t sigmask;
sigset_t sigpend;
-#ifndef _NO_UNDISPATCH
- /* Non-zero if there are undispatched signals for this thread. */
- int undispatched_signals;
-#endif
-
/* Thread state: */
enum pthread_state state;
enum pthread_state oldstate;
diff --git a/lib/libc_r/uthread/uthread_kern.c b/lib/libc_r/uthread/uthread_kern.c
index b83306157fc9..3e0ff17435db 100644
--- a/lib/libc_r/uthread/uthread_kern.c
+++ b/lib/libc_r/uthread/uthread_kern.c
@@ -39,7 +39,9 @@
#include <string.h>
#include <unistd.h>
#include <setjmp.h>
+#include <sys/param.h>
#include <sys/types.h>
+#include <sys/signalvar.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/socket.h>
@@ -122,16 +124,12 @@ __asm__("fnsave %0": :"m"(*fdata));
pthread_testcancel();
}
-#ifndef _NO_UNDISPATCH
/*
* Check for undispatched signals due to calls to
* pthread_kill().
*/
- if (_thread_run->undispatched_signals != 0) {
- _thread_run->undispatched_signals = 0;
+ if (SIGNOTEMPTY(_thread_run->sigpend))
_dispatch_signals();
- }
-#endif
if (_sched_switch_hook != NULL) {
/* Run the installed switch hook: */
diff --git a/lib/libc_r/uthread/uthread_sig.c b/lib/libc_r/uthread/uthread_sig.c
index 0f18477d0e9a..dc6d209f85b0 100644
--- a/lib/libc_r/uthread/uthread_sig.c
+++ b/lib/libc_r/uthread/uthread_sig.c
@@ -628,27 +628,10 @@ _thread_sig_send(pthread_t pthread, int sig)
!sigismember(&pthread->sigmask, sig)) {
/* Perform any state changes due to signal arrival: */
thread_sig_check_state(pthread, sig);
-
-#ifndef _NO_UNDISPATCH
- if (_thread_run != pthread) {
- /*
- * Make a note to call the signal handler once
- * the signaled thread is running. This is
- * necessary in order to make sure that the
- * signal is delivered on the correct stack.
- */
- pthread->undispatched_signals++;
- } else {
-#endif
- /* Call the installed signal handler. */
- _thread_sig_deliver(pthread, sig);
-#ifndef _NO_UNDISPATCH
- }
-#endif
- } else {
- /* Increment the pending signal count. */
- sigaddset(&pthread->sigpend,sig);
}
+
+ /* Increment the pending signal count. */
+ sigaddset(&pthread->sigpend,sig);
}
}
diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c
index b83306157fc9..3e0ff17435db 100644
--- a/lib/libkse/thread/thr_kern.c
+++ b/lib/libkse/thread/thr_kern.c
@@ -39,7 +39,9 @@
#include <string.h>
#include <unistd.h>
#include <setjmp.h>
+#include <sys/param.h>
#include <sys/types.h>
+#include <sys/signalvar.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/socket.h>
@@ -122,16 +124,12 @@ __asm__("fnsave %0": :"m"(*fdata));
pthread_testcancel();
}
-#ifndef _NO_UNDISPATCH
/*
* Check for undispatched signals due to calls to
* pthread_kill().
*/
- if (_thread_run->undispatched_signals != 0) {
- _thread_run->undispatched_signals = 0;
+ if (SIGNOTEMPTY(_thread_run->sigpend))
_dispatch_signals();
- }
-#endif
if (_sched_switch_hook != NULL) {
/* Run the installed switch hook: */
diff --git a/lib/libkse/thread/thr_private.h b/lib/libkse/thread/thr_private.h
index 8bc2d3fbcae8..560ea44d6145 100644
--- a/lib/libkse/thread/thr_private.h
+++ b/lib/libkse/thread/thr_private.h
@@ -572,11 +572,6 @@ struct pthread {
sigset_t sigmask;
sigset_t sigpend;
-#ifndef _NO_UNDISPATCH
- /* Non-zero if there are undispatched signals for this thread. */
- int undispatched_signals;
-#endif
-
/* Thread state: */
enum pthread_state state;
enum pthread_state oldstate;
diff --git a/lib/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c
index 0f18477d0e9a..dc6d209f85b0 100644
--- a/lib/libkse/thread/thr_sig.c
+++ b/lib/libkse/thread/thr_sig.c
@@ -628,27 +628,10 @@ _thread_sig_send(pthread_t pthread, int sig)
!sigismember(&pthread->sigmask, sig)) {
/* Perform any state changes due to signal arrival: */
thread_sig_check_state(pthread, sig);
-
-#ifndef _NO_UNDISPATCH
- if (_thread_run != pthread) {
- /*
- * Make a note to call the signal handler once
- * the signaled thread is running. This is
- * necessary in order to make sure that the
- * signal is delivered on the correct stack.
- */
- pthread->undispatched_signals++;
- } else {
-#endif
- /* Call the installed signal handler. */
- _thread_sig_deliver(pthread, sig);
-#ifndef _NO_UNDISPATCH
- }
-#endif
- } else {
- /* Increment the pending signal count. */
- sigaddset(&pthread->sigpend,sig);
}
+
+ /* Increment the pending signal count. */
+ sigaddset(&pthread->sigpend,sig);
}
}
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c
index b83306157fc9..3e0ff17435db 100644
--- a/lib/libpthread/thread/thr_kern.c
+++ b/lib/libpthread/thread/thr_kern.c
@@ -39,7 +39,9 @@
#include <string.h>
#include <unistd.h>
#include <setjmp.h>
+#include <sys/param.h>
#include <sys/types.h>
+#include <sys/signalvar.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/socket.h>
@@ -122,16 +124,12 @@ __asm__("fnsave %0": :"m"(*fdata));
pthread_testcancel();
}
-#ifndef _NO_UNDISPATCH
/*
* Check for undispatched signals due to calls to
* pthread_kill().
*/
- if (_thread_run->undispatched_signals != 0) {
- _thread_run->undispatched_signals = 0;
+ if (SIGNOTEMPTY(_thread_run->sigpend))
_dispatch_signals();
- }
-#endif
if (_sched_switch_hook != NULL) {
/* Run the installed switch hook: */
diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h
index 8bc2d3fbcae8..560ea44d6145 100644
--- a/lib/libpthread/thread/thr_private.h
+++ b/lib/libpthread/thread/thr_private.h
@@ -572,11 +572,6 @@ struct pthread {
sigset_t sigmask;
sigset_t sigpend;
-#ifndef _NO_UNDISPATCH
- /* Non-zero if there are undispatched signals for this thread. */
- int undispatched_signals;
-#endif
-
/* Thread state: */
enum pthread_state state;
enum pthread_state oldstate;
diff --git a/lib/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c
index 0f18477d0e9a..dc6d209f85b0 100644
--- a/lib/libpthread/thread/thr_sig.c
+++ b/lib/libpthread/thread/thr_sig.c
@@ -628,27 +628,10 @@ _thread_sig_send(pthread_t pthread, int sig)
!sigismember(&pthread->sigmask, sig)) {
/* Perform any state changes due to signal arrival: */
thread_sig_check_state(pthread, sig);
-
-#ifndef _NO_UNDISPATCH
- if (_thread_run != pthread) {
- /*
- * Make a note to call the signal handler once
- * the signaled thread is running. This is
- * necessary in order to make sure that the
- * signal is delivered on the correct stack.
- */
- pthread->undispatched_signals++;
- } else {
-#endif
- /* Call the installed signal handler. */
- _thread_sig_deliver(pthread, sig);
-#ifndef _NO_UNDISPATCH
- }
-#endif
- } else {
- /* Increment the pending signal count. */
- sigaddset(&pthread->sigpend,sig);
}
+
+ /* Increment the pending signal count. */
+ sigaddset(&pthread->sigpend,sig);
}
}