summaryrefslogtreecommitdiff
path: root/pthread_setcanceltype.c
diff options
context:
space:
mode:
authorrpj <rpj>2004-11-03 01:08:41 +0000
committerrpj <rpj>2004-11-03 01:08:41 +0000
commitec8290acdaea21b16d98f1ef5d4ae8a28ab2109a (patch)
tree0bd3750ec1cc12594b6cfe69473e393da6ec101b /pthread_setcanceltype.c
parentcccaf0c2c82e78a72d69a4a50c872f308bed2f65 (diff)
Mutex, semaphore, thread ID, test suite changes - see ChangeLogs
Diffstat (limited to 'pthread_setcanceltype.c')
-rw-r--r--pthread_setcanceltype.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/pthread_setcanceltype.c b/pthread_setcanceltype.c
index 9486353..5f88251 100644
--- a/pthread_setcanceltype.c
+++ b/pthread_setcanceltype.c
@@ -81,8 +81,9 @@ pthread_setcanceltype (int type, int *oldtype)
{
int result = 0;
pthread_t self = pthread_self ();
+ ptw32_thread_t * sp = (ptw32_thread_t *) self.p;
- if (self == NULL
+ if (sp == NULL
|| (type != PTHREAD_CANCEL_DEFERRED
&& type != PTHREAD_CANCEL_ASYNCHRONOUS))
{
@@ -92,32 +93,32 @@ pthread_setcanceltype (int type, int *oldtype)
/*
* Lock for async-cancel safety.
*/
- (void) pthread_mutex_lock (&self->cancelLock);
+ (void) pthread_mutex_lock (&sp->cancelLock);
if (oldtype != NULL)
{
- *oldtype = self->cancelType;
+ *oldtype = sp->cancelType;
}
- self->cancelType = type;
+ sp->cancelType = type;
/*
* Check if there is a pending asynchronous cancel
*/
- if (self->cancelState == PTHREAD_CANCEL_ENABLE
+ if (sp->cancelState == PTHREAD_CANCEL_ENABLE
&& type == PTHREAD_CANCEL_ASYNCHRONOUS
- && WaitForSingleObject (self->cancelEvent, 0) == WAIT_OBJECT_0)
+ && WaitForSingleObject (sp->cancelEvent, 0) == WAIT_OBJECT_0)
{
- self->state = PThreadStateCanceling;
- self->cancelState = PTHREAD_CANCEL_DISABLE;
- ResetEvent (self->cancelEvent);
- (void) pthread_mutex_unlock (&self->cancelLock);
+ sp->state = PThreadStateCanceling;
+ sp->cancelState = PTHREAD_CANCEL_DISABLE;
+ ResetEvent (sp->cancelEvent);
+ (void) pthread_mutex_unlock (&sp->cancelLock);
ptw32_throw (PTW32_EPS_CANCEL);
/* Never reached */
}
- (void) pthread_mutex_unlock (&self->cancelLock);
+ (void) pthread_mutex_unlock (&sp->cancelLock);
return (result);