diff options
Diffstat (limited to 'pthreads/pthread_setcancelstate.c')
-rw-r--r-- | pthreads/pthread_setcancelstate.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pthreads/pthread_setcancelstate.c b/pthreads/pthread_setcancelstate.c index 002cfe5e4..bbcd624af 100644 --- a/pthreads/pthread_setcancelstate.c +++ b/pthreads/pthread_setcancelstate.c @@ -79,6 +79,7 @@ pthread_setcancelstate (int state, int *oldstate) * ------------------------------------------------------ */ { + ptw32_mcs_local_node_t stateLock; int result = 0; pthread_t self = pthread_self (); ptw32_thread_t * sp = (ptw32_thread_t *) self.p; @@ -92,7 +93,7 @@ pthread_setcancelstate (int state, int *oldstate) /* * Lock for async-cancel safety. */ - (void) pthread_mutex_lock (&sp->cancelLock); + ptw32_mcs_lock_acquire (&sp->stateLock, &stateLock); if (oldstate != NULL) { @@ -111,13 +112,13 @@ pthread_setcancelstate (int state, int *oldstate) sp->state = PThreadStateCanceling; sp->cancelState = PTHREAD_CANCEL_DISABLE; ResetEvent (sp->cancelEvent); - (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); return (result); |