summaryrefslogtreecommitdiff
path: root/pthread_setcancelstate.c
diff options
context:
space:
mode:
authorrpj <rpj>2011-05-06 02:11:50 +0000
committerrpj <rpj>2011-05-06 02:11:50 +0000
commit2fe8aba6a8a4ce09f353f34881c77f93a9c01ca3 (patch)
treefd7f179b1abaa525ec55e34bef23b12f8fd89021 /pthread_setcancelstate.c
parent941d7cf87c60b55342b51e0b0fcd748589b76167 (diff)
Robust mutexes merged from devel branchpost_merge_with_ROBUST_MUTEXES
Diffstat (limited to 'pthread_setcancelstate.c')
-rw-r--r--pthread_setcancelstate.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/pthread_setcancelstate.c b/pthread_setcancelstate.c
index 002cfe5..bbcd624 100644
--- a/pthread_setcancelstate.c
+++ b/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);