From ec8290acdaea21b16d98f1ef5d4ae8a28ab2109a Mon Sep 17 00:00:00 2001 From: rpj Date: Wed, 3 Nov 2004 01:08:41 +0000 Subject: Mutex, semaphore, thread ID, test suite changes - see ChangeLogs --- ptw32_threadDestroy.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'ptw32_threadDestroy.c') diff --git a/ptw32_threadDestroy.c b/ptw32_threadDestroy.c index 58b23ff..9bca1b4 100644 --- a/ptw32_threadDestroy.c +++ b/ptw32_threadDestroy.c @@ -42,20 +42,21 @@ void ptw32_threadDestroy (pthread_t thread) { - struct pthread_t_ threadCopy; + ptw32_thread_t * tp = (ptw32_thread_t *) thread.p; + ptw32_thread_t threadCopy; - if (thread != NULL) + if (tp != NULL) { - (void) pthread_mutex_lock (&thread->cancelLock); - thread->state = PThreadStateLast; - (void) pthread_mutex_unlock (&thread->cancelLock); + (void) pthread_mutex_lock (&tp->cancelLock); + tp->state = PThreadStateLast; + (void) pthread_mutex_unlock (&tp->cancelLock); ptw32_callUserDestroyRoutines (thread); /* * Copy thread state so that the thread can be atomically NULLed. */ - memcpy (&threadCopy, thread, sizeof (threadCopy)); + memcpy (&threadCopy, tp, sizeof (threadCopy)); /* * Thread ID structs are never freed. They're NULLed and reused. -- cgit v1.2.3