diff options
author | davidxu <davidxu@FreeBSD.org> | 2010-09-10 01:47:37 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2010-09-10 01:47:37 +0000 |
commit | e129c18a83ef78db5e988b3cae51cdbedb5cf4a1 (patch) | |
tree | 2579648b96446e93c456b7056eb0f82f3e49c059 /lib/libthr/thread/thr_sig.c | |
parent | b27a644a18fdb284e46c52ec4b91be23562b515e (diff) | |
download | FreeBSD-src-e129c18a83ef78db5e988b3cae51cdbedb5cf4a1.zip FreeBSD-src-e129c18a83ef78db5e988b3cae51cdbedb5cf4a1.tar.gz |
Because POSIX does not allow EINTR to be returned from sigwait(),
add a wrapper for it in libc and rework the code in libthr, the
system call still can return EINTR, we keep this feature.
Discussed on: thread
Reviewed by: jilles
Diffstat (limited to 'lib/libthr/thread/thr_sig.c')
-rw-r--r-- | lib/libthr/thread/thr_sig.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index 5067e64..7bff32b 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -67,7 +67,7 @@ int _sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec * timeout); int __sigwaitinfo(const sigset_t *set, siginfo_t *info); int _sigwaitinfo(const sigset_t *set, siginfo_t *info); -int __sigwait(const sigset_t *set, int *sig); +int ___sigwait(const sigset_t *set, int *sig); int _sigwait(const sigset_t *set, int *sig); int __sigsuspend(const sigset_t *sigmask); int _sigaction(int, const struct sigaction *, struct sigaction *); @@ -634,7 +634,7 @@ __sigsuspend(const sigset_t * set) return (ret); } -__weak_reference(__sigwait, sigwait); +__weak_reference(___sigwait, sigwait); __weak_reference(__sigtimedwait, sigtimedwait); __weak_reference(__sigwaitinfo, sigwaitinfo); @@ -708,15 +708,17 @@ _sigwait(const sigset_t *set, int *sig) * it is not canceled. */ int -__sigwait(const sigset_t *set, int *sig) +___sigwait(const sigset_t *set, int *sig) { struct pthread *curthread = _get_curthread(); sigset_t newset; int ret; - _thr_cancel_enter(curthread); - ret = __sys_sigwait(thr_remove_thr_signals(set, &newset), sig); - _thr_cancel_leave(curthread, (ret != 0)); + do { + _thr_cancel_enter(curthread); + ret = __sys_sigwait(thr_remove_thr_signals(set, &newset), sig); + _thr_cancel_leave(curthread, (ret != 0)); + } while (ret == EINTR); return (ret); } |