summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2006-03-26 01:57:03 +0000
committerdavidxu <davidxu@FreeBSD.org>2006-03-26 01:57:03 +0000
commit32673f0256e4e7a641e4360babd09901b62d283c (patch)
tree4567475d90cc45f846ba9e55d72f1a34ee7313af /lib/libthr
parentb8703f41208ba1c4881a2630f941537cf353398d (diff)
downloadFreeBSD-src-32673f0256e4e7a641e4360babd09901b62d283c.zip
FreeBSD-src-32673f0256e4e7a641e4360babd09901b62d283c.tar.gz
Check cancellation state carefully to see we really need to call
_pthread_testcancel(). Preserve errno in _thr_suspend_check().
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_sig.c7
1 files changed, 5 insertions, 2 deletions
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
OpenPOWER on IntegriCloud