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 --- pthread_cond_wait.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'pthread_cond_wait.c') diff --git a/pthread_cond_wait.c b/pthread_cond_wait.c index 6db2a48..241f464 100644 --- a/pthread_cond_wait.c +++ b/pthread_cond_wait.c @@ -283,6 +283,17 @@ ptw32_cond_wait_cleanup (void *args) int nSignalsWasLeft; int result; + /* + * XSH: Upon successful return, the mutex has been locked and is owned + * by the calling thread. This must be done before any cancelation + * cleanup handlers are run. + */ + if ((result = pthread_mutex_lock (cleanup_args->mutexPtr)) != 0) + { + *resultPtr = result; + return; + } + /* * Whether we got here as a result of signal/broadcast or because of * timeout on wait or thread cancellation we indicate that we are no @@ -340,16 +351,6 @@ ptw32_cond_wait_cleanup (void *args) return; } } - - /* - * XSH: Upon successful return, the mutex has been locked and is owned - * by the calling thread - */ - if ((result = pthread_mutex_lock (cleanup_args->mutexPtr)) != 0) - { - *resultPtr = result; - } - } /* ptw32_cond_wait_cleanup */ static INLINE int -- cgit v1.2.3