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 --- w32_CancelableWait.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'w32_CancelableWait.c') diff --git a/w32_CancelableWait.c b/w32_CancelableWait.c index 97e15aa..070633e 100644 --- a/w32_CancelableWait.c +++ b/w32_CancelableWait.c @@ -110,21 +110,22 @@ ptw32_cancelable_wait (HANDLE waitHandle, DWORD timeout) if (sp != NULL) { + ptw32_mcs_local_node_t stateLock; /* * Should handle POSIX and implicit POSIX threads.. * Make sure we haven't been async-canceled in the meantime. */ - (void) pthread_mutex_lock (&sp->cancelLock); + ptw32_mcs_lock_acquire (&sp->stateLock, &stateLock); if (sp->state < PThreadStateCanceling) { 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 reached */ } - (void) pthread_mutex_unlock (&sp->cancelLock); + ptw32_mcs_lock_release (&stateLock); } /* Should never get to here. */ -- cgit v1.2.3