Date: Fri, 31 Dec 2004 15:09:27 GMT From: David Xu <davidxu@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 67994 for review Message-ID: <200412311509.iBVF9RZN009751@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=67994 Change 67994 by davidxu@davidxu_tiger on 2004/12/31 15:09:21 cancellation save/restore protocol is changed, followup. Affected files ... .. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_sem.c#3 edit Differences ... ==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_sem.c#3 (text+ko) ==== @@ -26,7 +26,7 @@ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libpthread/thread/thr_sem.c,v 1.15 2004/02/06 15:20:56 deischen Exp $ + * $FreeBSD: src/lib/libpthread/thread/thr_sem.c,v 1.16 2004/12/18 18:07:37 deischen Exp $ */ #include "namespace.h" @@ -140,16 +140,17 @@ _sem_wait(sem_t *sem) { struct pthread *curthread; + int oldcancel; int retval; if (sem_check_validity(sem) != 0) return (-1); + curthread = _get_curthread(); if ((*sem)->syssem != 0) { - curthread = _get_curthread(); - _thr_cancel_enter(curthread); + oldcancel = _thr_cancel_enter(curthread); retval = ksem_wait((*sem)->semid); - _thr_cancel_leave(curthread, retval != 0); + _thr_cancel_leave(curthread, oldcancel); } else { pthread_testcancel(); @@ -157,9 +158,9 @@ while ((*sem)->count <= 0) { (*sem)->nwaiters++; - pthread_cleanup_push(decrease_nwaiters, sem); + THR_CLEANUP_PUSH(curthread, decrease_nwaiters, sem); pthread_cond_wait(&(*sem)->gtzero, &(*sem)->lock); - pthread_cleanup_pop(0); + THR_CLEANUP_POP(curthread, 0); (*sem)->nwaiters--; } (*sem)->count--; @@ -177,6 +178,7 @@ { struct pthread *curthread; int retval; + int oldcancel; int timeout_invalid; if (sem_check_validity(sem) != 0) @@ -184,9 +186,9 @@ if ((*sem)->syssem != 0) { curthread = _get_curthread(); - _thr_cancel_enter(curthread); + oldcancel = _thr_cancel_enter(curthread); retval = ksem_timedwait((*sem)->semid, abs_timeout); - _thr_cancel_leave(curthread, retval != 0); + _thr_cancel_leave(curthread, oldcancel); } else { /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412311509.iBVF9RZN009751>