In most cases, cancel_point and cancel_async needn't be checked again,

because cancellation is almostly checked at cancellation points.
This commit is contained in:
David Xu 2010-09-24 07:52:07 +00:00
parent 433d4558c1
commit 93ea4a71bf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=213096
3 changed files with 3 additions and 5 deletions

View File

@ -131,9 +131,7 @@ _pthread_testcancel(void)
{
struct pthread *curthread = _get_curthread();
curthread->cancel_point = 1;
testcancel(curthread);
curthread->cancel_point = 0;
}
void
@ -159,7 +157,7 @@ _thr_cancel_enter2(struct pthread *curthread, int maycancel)
void
_thr_cancel_leave(struct pthread *curthread, int maycancel)
{
curthread->cancel_point = 0;
if (maycancel)
testcancel(curthread);
curthread->cancel_point = 0;
}

View File

@ -248,7 +248,8 @@ _fork(void)
_thr_rwlock_unlock(&_thr_atfork_lock);
curthread->no_cancel = cancelsave;
/* test async cancel */
_thr_testcancel(curthread);
if (curthread->cancel_async)
_thr_testcancel(curthread);
}
errno = errsave;

View File

@ -357,7 +357,6 @@ struct pthread {
#define SHOULD_CANCEL(thr) \
((thr)->cancel_pending && (thr)->cancel_enable && \
((thr)->cancel_point || (thr)->cancel_async) && \
(thr)->no_cancel == 0)
/* Cancellation is enabled */