diff options
author | davidxu <davidxu@FreeBSD.org> | 2010-09-24 13:01:01 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2010-09-24 13:01:01 +0000 |
commit | b0052272aae3fe76b39890669e62a34681624747 (patch) | |
tree | 64ad785e6a1d14e12e7e6d9186f466e9e03b9659 /lib/libthr | |
parent | b33b39bf8fca1665dc3b1f2d01092704fa9387d2 (diff) | |
download | FreeBSD-src-b0052272aae3fe76b39890669e62a34681624747.zip FreeBSD-src-b0052272aae3fe76b39890669e62a34681624747.tar.gz |
inline testcancel() into thr_cancel_leave(), because cancel_pending is
almost false, this makes a slight better branch predicting.
Diffstat (limited to 'lib/libthr')
-rw-r--r-- | lib/libthr/thread/thr_cancel.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_cancel.c b/lib/libthr/thread/thr_cancel.c index 8552e57..cd456b7 100644 --- a/lib/libthr/thread/thr_cancel.c +++ b/lib/libthr/thread/thr_cancel.c @@ -158,6 +158,7 @@ void _thr_cancel_leave(struct pthread *curthread, int maycancel) { curthread->cancel_point = 0; - if (maycancel) - testcancel(curthread); + if (__predict_false(SHOULD_CANCEL(curthread) && + !THR_IN_CRITICAL(curthread) && maycancel)) + _pthread_exit(PTHREAD_CANCELED); } |