summaryrefslogtreecommitdiffstats
path: root/lib/libkse
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>1998-06-17 03:53:16 +0000
committerjb <jb@FreeBSD.org>1998-06-17 03:53:16 +0000
commitad0611eef7186c1103b065d5ccd2c08dcb743cc9 (patch)
tree4af7a3453a5be08a86d84e8b6e0723e3b06a96f3 /lib/libkse
parent4c1835cfc41ea77e9c4d404822891fa41018e686 (diff)
downloadFreeBSD-src-ad0611eef7186c1103b065d5ccd2c08dcb743cc9.zip
FreeBSD-src-ad0611eef7186c1103b065d5ccd2c08dcb743cc9.tar.gz
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.
Diffstat (limited to 'lib/libkse')
-rw-r--r--lib/libkse/thread/thr_sig.c21
1 files changed, 20 insertions, 1 deletions
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;
OpenPOWER on IntegriCloud