From 3ce4e91d4eee5b75cdbbde4883a2ad93dfed6c54 Mon Sep 17 00:00:00 2001 From: David Xu Date: Tue, 5 Dec 2006 05:01:57 +0000 Subject: [PATCH] Tweak _thr_cancel_leave_defer a bit to fix a possible race. --- lib/libthr/thread/thr_cancel.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/libthr/thread/thr_cancel.c b/lib/libthr/thread/thr_cancel.c index 3222948b2c13..bf93fdcae4da 100644 --- a/lib/libthr/thread/thr_cancel.c +++ b/lib/libthr/thread/thr_cancel.c @@ -170,9 +170,13 @@ void _thr_cancel_leave_defer(struct pthread *curthread, int check) { if (curthread->cancel_enable) { - curthread->cancel_defer--; - if (check) + if (!check) { + curthread->cancel_point--; + curthread->cancel_defer--; + } else { + curthread->cancel_defer--; testcancel(curthread); - curthread->cancel_point--; + curthread->cancel_point--; + } } }