summaryrefslogtreecommitdiff
path: root/pthread_cond_wait.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_cond_wait.c
parentcccaf0c2c82e78a72d69a4a50c872f308bed2f65 (diff)
Mutex, semaphore, thread ID, test suite changes - see ChangeLogs
Diffstat (limited to 'pthread_cond_wait.c')
-rw-r--r--pthread_cond_wait.c21
1 files changed, 11 insertions, 10 deletions
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
@@ -284,6 +284,17 @@ ptw32_cond_wait_cleanup (void *args)
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
* longer waiting. The waiter is responsible for adjusting waiters
@@ -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