diff options
author | rpj <rpj> | 2004-11-03 01:08:41 +0000 |
---|---|---|
committer | rpj <rpj> | 2004-11-03 01:08:41 +0000 |
commit | ec8290acdaea21b16d98f1ef5d4ae8a28ab2109a (patch) | |
tree | 0bd3750ec1cc12594b6cfe69473e393da6ec101b /w32_CancelableWait.c | |
parent | cccaf0c2c82e78a72d69a4a50c872f308bed2f65 (diff) |
Mutex, semaphore, thread ID, test suite changes - see ChangeLogs
Diffstat (limited to 'w32_CancelableWait.c')
-rw-r--r-- | w32_CancelableWait.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/w32_CancelableWait.c b/w32_CancelableWait.c index a40fa4d..406bdbf 100644 --- a/w32_CancelableWait.c +++ b/w32_CancelableWait.c @@ -56,21 +56,25 @@ ptw32_cancelable_wait (HANDLE waitHandle, DWORD timeout) { int result; pthread_t self; + ptw32_thread_t * sp; HANDLE handles[2]; DWORD nHandles = 1; DWORD status; handles[0] = waitHandle; - if ((self = pthread_self ()) != NULL) + self = pthread_self(); + sp = (ptw32_thread_t *) self.p; + + if (sp != NULL) { /* * Get cancelEvent handle */ - if (self->cancelState == PTHREAD_CANCEL_ENABLE) + if (sp->cancelState == PTHREAD_CANCEL_ENABLE) { - if ((handles[1] = self->cancelEvent) != NULL) + if ((handles[1] = sp->cancelEvent) != NULL) { nHandles++; } @@ -83,7 +87,6 @@ ptw32_cancelable_wait (HANDLE waitHandle, DWORD timeout) status = WaitForMultipleObjects (nHandles, handles, PTW32_FALSE, timeout); - switch (status - WAIT_OBJECT_0) { case 0: @@ -105,23 +108,23 @@ ptw32_cancelable_wait (HANDLE waitHandle, DWORD timeout) */ ResetEvent (handles[1]); - if (self != NULL) + if (sp != NULL) { /* * Should handle POSIX and implicit POSIX threads.. * Make sure we haven't been async-canceled in the meantime. */ - (void) pthread_mutex_lock (&self->cancelLock); - if (self->state < PThreadStateCanceling) + (void) pthread_mutex_lock (&sp->cancelLock); + if (sp->state < PThreadStateCanceling) { - self->state = PThreadStateCanceling; - self->cancelState = PTHREAD_CANCEL_DISABLE; - (void) pthread_mutex_unlock (&self->cancelLock); + sp->state = PThreadStateCanceling; + sp->cancelState = PTHREAD_CANCEL_DISABLE; + (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); } /* Should never get to here. */ |