From db171f2f9435b98f05f33fcbc0dcf0c5cc1cb917 Mon Sep 17 00:00:00 2001 From: rpj Date: Thu, 24 Mar 2011 23:33:14 +0000 Subject: First pass of robust mutexes --- pthread_testcancel.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pthread_testcancel.c') diff --git a/pthread_testcancel.c b/pthread_testcancel.c index 9686d9e..6658650 100644 --- a/pthread_testcancel.c +++ b/pthread_testcancel.c @@ -68,6 +68,7 @@ pthread_testcancel (void) * ------------------------------------------------------ */ { + ptw32_mcs_local_node_t stateLock; pthread_t self = pthread_self (); ptw32_thread_t * sp = (ptw32_thread_t *) self.p; @@ -86,17 +87,17 @@ pthread_testcancel (void) return; } - (void) pthread_mutex_lock (&sp->cancelLock); + ptw32_mcs_lock_acquire (&sp->stateLock, &stateLock); if (sp->cancelState != PTHREAD_CANCEL_DISABLE) { ResetEvent(sp->cancelEvent); sp->state = PThreadStateCanceling; sp->cancelState = PTHREAD_CANCEL_DISABLE; - (void) pthread_mutex_unlock (&sp->cancelLock); + ptw32_mcs_lock_release (&stateLock); ptw32_throw (PTW32_EPS_CANCEL); /* Never returns here */ } - (void) pthread_mutex_unlock (&sp->cancelLock); + ptw32_mcs_lock_release (&stateLock); } /* pthread_testcancel */ -- cgit v1.2.3