From 32673f0256e4e7a641e4360babd09901b62d283c Mon Sep 17 00:00:00 2001 From: davidxu Date: Sun, 26 Mar 2006 01:57:03 +0000 Subject: Check cancellation state carefully to see we really need to call _pthread_testcancel(). Preserve errno in _thr_suspend_check(). --- lib/libthr/thread/thr_sig.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/libthr/thread') diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index 335fa09..71f97a0 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -57,8 +57,8 @@ void _thr_ast(struct pthread *curthread) { if (!THR_IN_CRITICAL(curthread)) { - if (__predict_false(curthread->cancelflags & - THR_CANCEL_AT_POINT)) + if (__predict_false( + SHOULD_ASYNC_CANCEL(curthread->cancelflags))) _pthread_testcancel(); if (__predict_false((curthread->flags & (THR_FLAGS_NEED_SUSPEND | THR_FLAGS_SUSPENDED)) @@ -71,7 +71,9 @@ void _thr_suspend_check(struct pthread *curthread) { umtx_t cycle; + int err; + err = errno; /* * Blocks SIGCANCEL which other threads must send. */ @@ -115,6 +117,7 @@ _thr_suspend_check(struct pthread *curthread) * have one nesting signal frame, this should be fine. */ _thr_signal_unblock(curthread); + errno = err; } void -- cgit v1.1