summaryrefslogtreecommitdiff
path: root/pthread_setcancelstate.c
diff options
context:
space:
mode:
authorrpj <rpj>2004-05-17 01:38:02 +0000
committerrpj <rpj>2004-05-17 01:38:02 +0000
commit771465fed0cf50ee2dd790723245fc091699c324 (patch)
treed8c18d095a33fe7c4564bd90c5f313bb9e4057dd /pthread_setcancelstate.c
parent8b14911744f58cbe3730703f3fcc41cd969fd0f3 (diff)
re-indentation, bug fixes, hooks for pre-emptive async cancelation
Diffstat (limited to 'pthread_setcancelstate.c')
-rw-r--r--pthread_setcancelstate.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/pthread_setcancelstate.c b/pthread_setcancelstate.c
index dcea53e..4432a6f 100644
--- a/pthread_setcancelstate.c
+++ b/pthread_setcancelstate.c
@@ -80,11 +80,10 @@ pthread_setcancelstate (int state, int *oldstate)
*/
{
int result = 0;
- pthread_t self = pthread_self();
+ pthread_t self = pthread_self ();
if (self == NULL
- || (state != PTHREAD_CANCEL_ENABLE
- && state != PTHREAD_CANCEL_DISABLE))
+ || (state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE))
{
return EINVAL;
}
@@ -92,7 +91,7 @@ pthread_setcancelstate (int state, int *oldstate)
/*
* Lock for async-cancel safety.
*/
- (void) pthread_mutex_lock(&self->cancelLock);
+ (void) pthread_mutex_lock (&self->cancelLock);
if (oldstate != NULL)
{
@@ -106,20 +105,19 @@ pthread_setcancelstate (int state, int *oldstate)
*/
if (state == PTHREAD_CANCEL_ENABLE
&& self->cancelType == PTHREAD_CANCEL_ASYNCHRONOUS
- && WaitForSingleObject(self->cancelEvent, 0) == WAIT_OBJECT_0)
+ && WaitForSingleObject (self->cancelEvent, 0) == WAIT_OBJECT_0)
{
self->state = PThreadStateCanceling;
self->cancelState = PTHREAD_CANCEL_DISABLE;
- ResetEvent(self->cancelEvent);
- (void) pthread_mutex_unlock(&self->cancelLock);
- ptw32_throw(PTW32_EPS_CANCEL);
+ ResetEvent (self->cancelEvent);
+ (void) pthread_mutex_unlock (&self->cancelLock);
+ ptw32_throw (PTW32_EPS_CANCEL);
/* Never reached */
}
- (void) pthread_mutex_unlock(&self->cancelLock);
+ (void) pthread_mutex_unlock (&self->cancelLock);
return (result);
-} /* pthread_setcancelstate */
-
+} /* pthread_setcancelstate */