diff options
author | davidxu <davidxu@FreeBSD.org> | 2014-03-17 05:03:53 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2014-03-17 05:03:53 +0000 |
commit | fedd0354840e4cdb1e121076e56896edd30432b0 (patch) | |
tree | 483c46ff8b7817a42d0c065cc25581e6d21bb351 /lib/libc/gen | |
parent | bcee023c7fdb5c4cabea2dd9180eaf0781eee8c2 (diff) | |
download | FreeBSD-src-fedd0354840e4cdb1e121076e56896edd30432b0.zip FreeBSD-src-fedd0354840e4cdb1e121076e56896edd30432b0.tar.gz |
MFC r263107:
To avoid missing a chance to cancel thread, call _pthread_testcancel at the
beginning of _sem_timedwait.
Submitted by: Eric van Gyzen < eric at vangyzen dot net >
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/sem_new.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc/gen/sem_new.c b/lib/libc/gen/sem_new.c index 1bf84ea..9a2ab27 100644 --- a/lib/libc/gen/sem_new.c +++ b/lib/libc/gen/sem_new.c @@ -381,6 +381,7 @@ _sem_timedwait(sem_t * __restrict sem, return (-1); retval = 0; + _pthread_testcancel(); for (;;) { while ((val = sem->_kern._count) > 0) { if (atomic_cmpset_acq_int(&sem->_kern._count, val, val - 1)) |