diff options
author | Daniel Eischen <deischen@FreeBSD.org> | 2002-05-24 04:32:28 +0000 |
---|---|---|
committer | Daniel Eischen <deischen@FreeBSD.org> | 2002-05-24 04:32:28 +0000 |
commit | 5eb8d1f0b06897d05898ed3ba684d8860f9bef97 (patch) | |
tree | 15691e04d3960954bb9843fcfd9d5beaf2553f80 /lib/libpthread/thread/thr_sig.c | |
parent | a119f259955f142a20d551d91b53716aecd57edb (diff) |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_sig.c')
-rw-r--r-- | lib/libpthread/thread/thr_sig.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c index 1bd93b7d67cbd..7aa9b53967b32 100644 --- a/lib/libpthread/thread/thr_sig.c +++ b/lib/libpthread/thread/thr_sig.c @@ -54,7 +54,7 @@ static void thread_sigframe_save(struct pthread *thread, static void thread_sig_invoke_handler(int sig, siginfo_t *info, ucontext_t *ucp); -/* #define DEBUG_SIGNAL */ +/*#define DEBUG_SIGNAL*/ #ifdef DEBUG_SIGNAL #define DBG_MSG stdout_debug #else @@ -375,7 +375,8 @@ thread_sig_find(int sig) return (NULL); } else if ((handler_installed != 0) && - !sigismember(&pthread->sigmask, sig)) { + !sigismember(&pthread->sigmask, sig) && + ((pthread->flags & PTHREAD_FLAGS_SUSPENDED) == 0)) { if (pthread->state == PS_SIGSUSPEND) { if (suspended_thread == NULL) suspended_thread = pthread; @@ -791,10 +792,17 @@ thread_sig_add(struct pthread *pthread, int sig, int has_args) /* * The thread should be removed from all scheduling * queues at this point. Raise the priority and place - * the thread in the run queue. + * the thread in the run queue. It is also possible + * for a signal to be sent to a suspended thread, + * mostly via pthread_kill(). If a thread is suspended, + * don't insert it into the priority queue; just set + * its state to suspended and it will run the signal + * handler when it is resumed. */ pthread->active_priority |= PTHREAD_SIGNAL_PRIORITY; - if (thread_is_active == 0) + if ((pthread->flags & PTHREAD_FLAGS_SUSPENDED) != 0) + PTHREAD_SET_STATE(pthread, PS_SUSPENDED); + else if (thread_is_active == 0) PTHREAD_PRIOQ_INSERT_TAIL(pthread); } } |