From 8b258c151d8d0cb6c04331767b23bdf09a72c8a1 Mon Sep 17 00:00:00 2001 From: David Xu Date: Thu, 3 Jul 2003 10:12:21 +0000 Subject: [PATCH] Check if thread is in critical region, only testing check_pending is not enough. --- lib/libkse/thread/thr_kern.c | 3 ++- lib/libpthread/thread/thr_kern.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c index f7575adb431..d2567b75e84 100644 --- a/lib/libkse/thread/thr_kern.c +++ b/lib/libkse/thread/thr_kern.c @@ -673,7 +673,8 @@ _thr_sched_switch_unlocked(struct pthread *curthread) /* * This thread is being resumed; check for cancellations. */ - if ((psf.psf_valid || curthread->check_pending)) { + if ((psf.psf_valid || + (curthread->check_pending && !THR_IN_CRITICAL(curthread)))) { resume_once = 0; THR_GETCONTEXT(&uc); if (resume_once == 0) { diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c index f7575adb431..d2567b75e84 100644 --- a/lib/libpthread/thread/thr_kern.c +++ b/lib/libpthread/thread/thr_kern.c @@ -673,7 +673,8 @@ _thr_sched_switch_unlocked(struct pthread *curthread) /* * This thread is being resumed; check for cancellations. */ - if ((psf.psf_valid || curthread->check_pending)) { + if ((psf.psf_valid || + (curthread->check_pending && !THR_IN_CRITICAL(curthread)))) { resume_once = 0; THR_GETCONTEXT(&uc); if (resume_once == 0) {