diff options
author | jb <jb@FreeBSD.org> | 1998-06-17 03:53:16 +0000 |
---|---|---|
committer | jb <jb@FreeBSD.org> | 1998-06-17 03:53:16 +0000 |
commit | ad0611eef7186c1103b065d5ccd2c08dcb743cc9 (patch) | |
tree | 4af7a3453a5be08a86d84e8b6e0723e3b06a96f3 /lib/libc_r/uthread | |
parent | 4c1835cfc41ea77e9c4d404822891fa41018e686 (diff) | |
download | FreeBSD-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/libc_r/uthread')
-rw-r--r-- | lib/libc_r/uthread/uthread_sig.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/libc_r/uthread/uthread_sig.c b/lib/libc_r/uthread/uthread_sig.c index 1b1542e..cb323e7 100644 --- a/lib/libc_r/uthread/uthread_sig.c +++ b/lib/libc_r/uthread/uthread_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; |