From e5c66a0d9ef2fe608edbf5519f3bcee91715590a Mon Sep 17 00:00:00 2001 From: David Xu Date: Fri, 24 Sep 2010 13:01:01 +0000 Subject: [PATCH] inline testcancel() into thr_cancel_leave(), because cancel_pending is almost false, this makes a slight better branch predicting. --- lib/libthr/thread/thr_cancel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libthr/thread/thr_cancel.c b/lib/libthr/thread/thr_cancel.c index 8552e57d3ec..cd456b750df 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); }