diff options
| author | David Xu <davidxu@FreeBSD.org> | 2003-07-09 14:30:51 +0000 |
|---|---|---|
| committer | David Xu <davidxu@FreeBSD.org> | 2003-07-09 14:30:51 +0000 |
| commit | d80384bc8dae3cb11739fe7483ba06941725e1eb (patch) | |
| tree | d2daeb2dd73fe7becbb0e19db3e0b8d877165b8a /lib/libpthread/thread/thr_sigwait.c | |
| parent | e25d3184d0d926dd5a2cf7803c15da7b377814af (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_sigwait.c')
| -rw-r--r-- | lib/libpthread/thread/thr_sigwait.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libpthread/thread/thr_sigwait.c b/lib/libpthread/thread/thr_sigwait.c index ac4497287c19..46dac92e3c3b 100644 --- a/lib/libpthread/thread/thr_sigwait.c +++ b/lib/libpthread/thread/thr_sigwait.c @@ -123,6 +123,7 @@ lib_sigtimedwait(const sigset_t *set, siginfo_t *info, } } curthread->timeout = 0; + curthread->interrupted = 0; _thr_set_timeout(timeout); /* Wait for a signal: */ curthread->oldsigmask = curthread->sigmask; @@ -134,18 +135,18 @@ lib_sigtimedwait(const sigset_t *set, siginfo_t *info, _thr_sched_switch_unlocked(curthread); /* * Return the signal number to the caller: - * XXX Here is race, how about a signal come in before - * we reach here? so we might got an incorrect timeout - * status. */ if (siginfo.si_signo > 0) { ret = siginfo.si_signo; } else { - if (curthread->timeout) + if (curthread->interrupted) + errno = EINTR; + else if (curthread->timeout) errno = EAGAIN; ret = -1; } - + curthread->timeout = 0; + curthread->interrupted = 0; /* * Probably unnecessary, but since it's in a union struct * we don't know how it could be used in the future. |
