diff options
Diffstat (limited to 'pthread_cond_destroy.c')
-rw-r--r-- | pthread_cond_destroy.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pthread_cond_destroy.c b/pthread_cond_destroy.c index 5eab110..9c4a214 100644 --- a/pthread_cond_destroy.c +++ b/pthread_cond_destroy.c @@ -126,6 +126,8 @@ pthread_cond_destroy (pthread_cond_t * cond) return EINVAL; } + EnterCriticalSection(&ptw32_cond_list_lock); + if (*cond != PTHREAD_COND_INITIALIZER) { cv = *cond; @@ -168,8 +170,6 @@ pthread_cond_destroy (pthread_cond_t * cond) /* * Now it is safe to destroy */ - EnterCriticalSection(&ptw32_cond_list_lock); - *cond = NULL; if (sem_destroy(&(cv->semBlockLock)) != 0) @@ -205,8 +205,6 @@ pthread_cond_destroy (pthread_cond_t * cond) cv->next->prev = cv->prev; } - LeaveCriticalSection(&ptw32_cond_list_lock); - (void) free(cv); } } @@ -242,5 +240,7 @@ pthread_cond_destroy (pthread_cond_t * cond) LeaveCriticalSection(&ptw32_cond_test_init_lock); } + LeaveCriticalSection(&ptw32_cond_list_lock); + return ((result != 0) ? result : ((result1 != 0) ? result1 : result2)); } |