From ad0611eef7186c1103b065d5ccd2c08dcb743cc9 Mon Sep 17 00:00:00 2001 From: jb Date: Wed, 17 Jun 1998 03:53:16 +0000 Subject: If a thread is waiting on a child process to complete, the SIGCHLD signal can arrive before the thread is woken from it's wait4. In this case, don't return an EINTR, just set the thread state to running and the wait4 wrapper will loop and get the exit status of the process. --- lib/libkse/thread/thr_sig.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'lib/libkse') diff --git a/lib/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c index 1b1542e..cb323e7 100644 --- a/lib/libkse/thread/thr_sig.c +++ b/lib/libkse/thread/thr_sig.c @@ -264,6 +264,26 @@ _thread_signal(pthread_t pthread, int sig) break; /* + * The wait state is a special case due to the handling of + * SIGCHLD signals. + */ + case PS_WAIT_WAIT: + /* + * Check for signals other than the death of a child + * process: + */ + if (sig != SIGCHLD) + /* Flag the operation as interrupted: */ + pthread->interrupted = 1; + + /* Change the state of the thread to run: */ + PTHREAD_NEW_STATE(pthread,PS_RUNNING); + + /* Return the signal number: */ + pthread->signo = sig; + break; + + /* * States that are interrupted by the occurrence of a signal * other than the scheduling alarm: */ @@ -271,7 +291,6 @@ _thread_signal(pthread_t pthread, int sig) case PS_FDW_WAIT: case PS_SLEEP_WAIT: case PS_SIGWAIT: - case PS_WAIT_WAIT: case PS_SELECT_WAIT: /* Flag the operation as interrupted: */ pthread->interrupted = 1; -- cgit v1.1