From c471a4b5e0b0872a9e1249284ce55428b563da0d Mon Sep 17 00:00:00 2001 From: jb Date: Sun, 31 May 1998 23:46:01 +0000 Subject: [PATCH] Don't restart a syscall when a SIGCHLD is received by a thread waiting on a child process. --- lib/libc_r/uthread/uthread_sig.c | 7 ++++++- lib/libkse/thread/thr_sig.c | 7 ++++++- lib/libpthread/thread/thr_sig.c | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/libc_r/uthread/uthread_sig.c b/lib/libc_r/uthread/uthread_sig.c index 1e5ee630ce4b..3fa3c5655c19 100644 --- a/lib/libc_r/uthread/uthread_sig.c +++ b/lib/libc_r/uthread/uthread_sig.c @@ -242,8 +242,13 @@ _thread_signal(pthread_t pthread, int sig) */ sigaddset(&pthread->sigpend,sig); + /* Check if the thread is waiting on a child process: */ + if (sig == SIGCHLD && pthread->state == PS_WAIT_WAIT) { + /* Change the state of the thread to run: */ + PTHREAD_NEW_STATE(pthread,PS_RUNNING); + /* Check if system calls are not restarted: */ - if ((_thread_sigact[sig - 1].sa_flags & SA_RESTART) == 0) { + } else if ((_thread_sigact[sig - 1].sa_flags & SA_RESTART) == 0) { /* * Process according to thread state: */ diff --git a/lib/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c index 1e5ee630ce4b..3fa3c5655c19 100644 --- a/lib/libkse/thread/thr_sig.c +++ b/lib/libkse/thread/thr_sig.c @@ -242,8 +242,13 @@ _thread_signal(pthread_t pthread, int sig) */ sigaddset(&pthread->sigpend,sig); + /* Check if the thread is waiting on a child process: */ + if (sig == SIGCHLD && pthread->state == PS_WAIT_WAIT) { + /* Change the state of the thread to run: */ + PTHREAD_NEW_STATE(pthread,PS_RUNNING); + /* Check if system calls are not restarted: */ - if ((_thread_sigact[sig - 1].sa_flags & SA_RESTART) == 0) { + } else if ((_thread_sigact[sig - 1].sa_flags & SA_RESTART) == 0) { /* * Process according to thread state: */ diff --git a/lib/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c index 1e5ee630ce4b..3fa3c5655c19 100644 --- a/lib/libpthread/thread/thr_sig.c +++ b/lib/libpthread/thread/thr_sig.c @@ -242,8 +242,13 @@ _thread_signal(pthread_t pthread, int sig) */ sigaddset(&pthread->sigpend,sig); + /* Check if the thread is waiting on a child process: */ + if (sig == SIGCHLD && pthread->state == PS_WAIT_WAIT) { + /* Change the state of the thread to run: */ + PTHREAD_NEW_STATE(pthread,PS_RUNNING); + /* Check if system calls are not restarted: */ - if ((_thread_sigact[sig - 1].sa_flags & SA_RESTART) == 0) { + } else if ((_thread_sigact[sig - 1].sa_flags & SA_RESTART) == 0) { /* * Process according to thread state: */