Date: Fri, 24 Sep 2010 07:52:07 +0000 (UTC) From: David Xu <davidxu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r213096 - head/lib/libthr/thread Message-ID: <201009240752.o8O7q7Zh094102@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: davidxu Date: Fri Sep 24 07:52:07 2010 New Revision: 213096 URL: http://svn.freebsd.org/changeset/base/213096 Log: In most cases, cancel_point and cancel_async needn't be checked again, because cancellation is almostly checked at cancellation points. Modified: head/lib/libthr/thread/thr_cancel.c head/lib/libthr/thread/thr_fork.c head/lib/libthr/thread/thr_private.h Modified: head/lib/libthr/thread/thr_cancel.c ============================================================================== --- head/lib/libthr/thread/thr_cancel.c Fri Sep 24 07:29:29 2010 (r213095) +++ head/lib/libthr/thread/thr_cancel.c Fri Sep 24 07:52:07 2010 (r213096) @@ -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 *curth void _thr_cancel_leave(struct pthread *curthread, int maycancel) { + curthread->cancel_point = 0; if (maycancel) testcancel(curthread); - curthread->cancel_point = 0; } Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Fri Sep 24 07:29:29 2010 (r213095) +++ head/lib/libthr/thread/thr_fork.c Fri Sep 24 07:52:07 2010 (r213096) @@ -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; Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Fri Sep 24 07:29:29 2010 (r213095) +++ head/lib/libthr/thread/thr_private.h Fri Sep 24 07:52:07 2010 (r213096) @@ -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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009240752.o8O7q7Zh094102>