summaryrefslogtreecommitdiff
path: root/pthread_cancel.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_cancel.c
parent941d7cf87c60b55342b51e0b0fcd748589b76167 (diff)
Robust mutexes merged from devel branchpost_merge_with_ROBUST_MUTEXES
Diffstat (limited to 'pthread_cancel.c')
-rw-r--r--pthread_cancel.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/pthread_cancel.c b/pthread_cancel.c
index 1d2ea67..ae60b72 100644
--- a/pthread_cancel.c
+++ b/pthread_cancel.c
@@ -99,6 +99,7 @@ pthread_cancel (pthread_t thread)
int cancel_self;
pthread_t self;
ptw32_thread_t * tp;
+ ptw32_mcs_local_node_t stateLock;
result = pthread_kill (thread, 0);
@@ -125,7 +126,7 @@ pthread_cancel (pthread_t thread)
/*
* Lock for async-cancel safety.
*/
- (void) pthread_mutex_lock (&tp->cancelLock);
+ ptw32_mcs_lock_acquire (&tp->stateLock, &stateLock);
if (tp->cancelType == PTHREAD_CANCEL_ASYNCHRONOUS
&& tp->cancelState == PTHREAD_CANCEL_ENABLE
@@ -136,7 +137,7 @@ pthread_cancel (pthread_t thread)
tp->state = PThreadStateCanceling;
tp->cancelState = PTHREAD_CANCEL_DISABLE;
- (void) pthread_mutex_unlock (&tp->cancelLock);
+ ptw32_mcs_lock_release (&stateLock);
ptw32_throw (PTW32_EPS_CANCEL);
/* Never reached */
@@ -158,7 +159,7 @@ pthread_cancel (pthread_t thread)
* the threadH arg will be used.
*/
ptw32_register_cancelation ((PAPCFUNC)ptw32_cancel_callback, threadH, 0);
- (void) pthread_mutex_unlock (&tp->cancelLock);
+ ptw32_mcs_lock_release (&stateLock);
ResumeThread (threadH);
}
}
@@ -181,7 +182,7 @@ pthread_cancel (pthread_t thread)
result = ESRCH;
}
- (void) pthread_mutex_unlock (&tp->cancelLock);
+ ptw32_mcs_lock_release (&stateLock);
}
return (result);