summaryrefslogtreecommitdiff
path: root/pthread_cond_destroy.c
diff options
context:
space:
mode:
Diffstat (limited to 'pthread_cond_destroy.c')
-rw-r--r--pthread_cond_destroy.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/pthread_cond_destroy.c b/pthread_cond_destroy.c
index 3d29ffc..53f7a53 100644
--- a/pthread_cond_destroy.c
+++ b/pthread_cond_destroy.c
@@ -135,21 +135,28 @@ pthread_cond_destroy (pthread_cond_t * cond)
* all already signaled waiters to let them retract their
* waiter status - SEE NOTE 1 ABOVE!!!
*/
- if (sem_wait (&(cv->semBlockLock)) != 0)
+ if (ptw32_semwait (&(cv->semBlockLock)) != 0) /* Non-cancelable */
{
- return errno;
+ result = errno;
}
-
- /*
- * !TRY! lock mtxUnblockLock; try will detect busy condition
- * and will not cause a deadlock with respect to concurrent
- * signal/broadcast.
- */
- if ((result = pthread_mutex_trylock (&(cv->mtxUnblockLock))) != 0)
- {
- (void) sem_post (&(cv->semBlockLock));
- return result;
+ else
+ {
+ /*
+ * !TRY! lock mtxUnblockLock; try will detect busy condition
+ * and will not cause a deadlock with respect to concurrent
+ * signal/broadcast.
+ */
+ if ((result = pthread_mutex_trylock (&(cv->mtxUnblockLock))) != 0)
+ {
+ (void) sem_post (&(cv->semBlockLock));
+ }
}
+
+ if (result != 0)
+ {
+ LeaveCriticalSection (&ptw32_cond_list_lock);
+ return result;
+ }
/*
* Check whether cv is still busy (still has waiters)