From 3b63c6c8ea0ce2b74844269ccc07d0d4745c2a61 Mon Sep 17 00:00:00 2001 From: Jonathan Mini Date: Sun, 23 Feb 2003 21:15:25 +0000 Subject: [PATCH] Insert threads interrupted by a signal while running onto the run queue. --- lib/libkse/thread/thr_sig.c | 26 ++------------------------ lib/libkse/thread/thr_sigaction.c | 3 +-- lib/libpthread/thread/thr_sig.c | 26 ++------------------------ lib/libpthread/thread/thr_sigaction.c | 3 +-- 4 files changed, 6 insertions(+), 52 deletions(-) diff --git a/lib/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c index a93b406d5987..fa63b5fd2cf8 100644 --- a/lib/libkse/thread/thr_sig.c +++ b/lib/libkse/thread/thr_sig.c @@ -357,7 +357,6 @@ static void thread_sig_add(struct pthread *pthread, int sig, int has_args) { int suppress_handler = 0; - int thread_is_active = 0; /* Make sure this signal isn't still in the pending set: */ sigdelset(&pthread->sigpend, sig); @@ -390,12 +389,6 @@ thread_sig_add(struct pthread *pthread, int sig, int has_args) */ if ((pthread->flags & PTHREAD_FLAGS_IN_PRIOQ) != 0) PTHREAD_PRIOQ_REMOVE(pthread); - else - /* - * This thread is running; avoid placing it in - * the run queue: - */ - thread_is_active = 1; break; case PS_SUSPENDED: @@ -491,8 +484,7 @@ thread_sig_add(struct pthread *pthread, int sig, int has_args) break; } - DBG_MSG(">>> suppress_handler = %d, thread_is_active = %d\n", - suppress_handler, thread_is_active); + DBG_MSG(">>> suppress_handler = %d\n", suppress_handler); if (suppress_handler == 0) { /* Setup a signal frame and save the current threads state: */ @@ -520,7 +512,7 @@ thread_sig_add(struct pthread *pthread, int sig, int has_args) pthread->active_priority |= PTHREAD_SIGNAL_PRIORITY; if ((pthread->flags & PTHREAD_FLAGS_SUSPENDED) != 0) PTHREAD_SET_STATE(pthread, PS_SUSPENDED); - else if (thread_is_active == 0) + else PTHREAD_PRIOQ_INSERT_TAIL(pthread); } } @@ -757,20 +749,6 @@ thread_sigframe_add(struct pthread *thread, int sig, int has_args) SIGSETOR(thread->mailbox.tm_context.uc_sigmask, _thread_sigact[sig - 1].sa_mask); sigaddset(&thread->mailbox.tm_context.uc_sigmask, sig); -#if 0 - /* Set up the new frame. */ - thread->curframe = psf; - thread->flags &= PTHREAD_FLAGS_PRIVATE | PTHREAD_FLAGS_TRACE | - PTHREAD_FLAGS_IN_SYNCQ; - - /* - * Set up the context: - */ - stackp -= sizeof(double); - _setjmp(thread->ctx.jb); - SET_STACK_JB(thread->ctx.jb, stackp); - SET_RETURN_ADDR_JB(thread->ctx.jb, _thread_sig_wrapper); -#endif } static void diff --git a/lib/libkse/thread/thr_sigaction.c b/lib/libkse/thread/thr_sigaction.c index 741b9c22bb40..a16f859024ea 100644 --- a/lib/libkse/thread/thr_sigaction.c +++ b/lib/libkse/thread/thr_sigaction.c @@ -76,8 +76,7 @@ _sigaction(int sig, const struct sigaction * act, struct sigaction * oact) * Check if the kernel needs to be advised of a change * in signal action: */ - if (act != NULL && sig != _SCHED_SIGNAL && sig != SIGCHLD && - sig != SIGINFO) { + if (act != NULL && sig != SIGCHLD) { /* * Ensure the signal handler cannot be interrupted * by other signals. Always request the POSIX signal diff --git a/lib/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c index a93b406d5987..fa63b5fd2cf8 100644 --- a/lib/libpthread/thread/thr_sig.c +++ b/lib/libpthread/thread/thr_sig.c @@ -357,7 +357,6 @@ static void thread_sig_add(struct pthread *pthread, int sig, int has_args) { int suppress_handler = 0; - int thread_is_active = 0; /* Make sure this signal isn't still in the pending set: */ sigdelset(&pthread->sigpend, sig); @@ -390,12 +389,6 @@ thread_sig_add(struct pthread *pthread, int sig, int has_args) */ if ((pthread->flags & PTHREAD_FLAGS_IN_PRIOQ) != 0) PTHREAD_PRIOQ_REMOVE(pthread); - else - /* - * This thread is running; avoid placing it in - * the run queue: - */ - thread_is_active = 1; break; case PS_SUSPENDED: @@ -491,8 +484,7 @@ thread_sig_add(struct pthread *pthread, int sig, int has_args) break; } - DBG_MSG(">>> suppress_handler = %d, thread_is_active = %d\n", - suppress_handler, thread_is_active); + DBG_MSG(">>> suppress_handler = %d\n", suppress_handler); if (suppress_handler == 0) { /* Setup a signal frame and save the current threads state: */ @@ -520,7 +512,7 @@ thread_sig_add(struct pthread *pthread, int sig, int has_args) pthread->active_priority |= PTHREAD_SIGNAL_PRIORITY; if ((pthread->flags & PTHREAD_FLAGS_SUSPENDED) != 0) PTHREAD_SET_STATE(pthread, PS_SUSPENDED); - else if (thread_is_active == 0) + else PTHREAD_PRIOQ_INSERT_TAIL(pthread); } } @@ -757,20 +749,6 @@ thread_sigframe_add(struct pthread *thread, int sig, int has_args) SIGSETOR(thread->mailbox.tm_context.uc_sigmask, _thread_sigact[sig - 1].sa_mask); sigaddset(&thread->mailbox.tm_context.uc_sigmask, sig); -#if 0 - /* Set up the new frame. */ - thread->curframe = psf; - thread->flags &= PTHREAD_FLAGS_PRIVATE | PTHREAD_FLAGS_TRACE | - PTHREAD_FLAGS_IN_SYNCQ; - - /* - * Set up the context: - */ - stackp -= sizeof(double); - _setjmp(thread->ctx.jb); - SET_STACK_JB(thread->ctx.jb, stackp); - SET_RETURN_ADDR_JB(thread->ctx.jb, _thread_sig_wrapper); -#endif } static void diff --git a/lib/libpthread/thread/thr_sigaction.c b/lib/libpthread/thread/thr_sigaction.c index 741b9c22bb40..a16f859024ea 100644 --- a/lib/libpthread/thread/thr_sigaction.c +++ b/lib/libpthread/thread/thr_sigaction.c @@ -76,8 +76,7 @@ _sigaction(int sig, const struct sigaction * act, struct sigaction * oact) * Check if the kernel needs to be advised of a change * in signal action: */ - if (act != NULL && sig != _SCHED_SIGNAL && sig != SIGCHLD && - sig != SIGINFO) { + if (act != NULL && sig != SIGCHLD) { /* * Ensure the signal handler cannot be interrupted * by other signals. Always request the POSIX signal