Fix pthread_cond_wait() to prevent race

This commit is contained in:
Sergey Lyubka committed 2011-03-31 17:59:23 +02:00
1 parent 4619c1a71e
commit 6a43bd952f
1 file changed
+1 -1
+1 -1
View File
@@ -849,7 +849,7 @@ static int pthread_cond_wait(pthread_cond_t *cv, pthread_mutex_t *mutex) {
HANDLE handles[] = {cv->signal, cv->broadcast};
ReleaseMutex(*mutex);
WaitForMultipleObjects(2, handles, FALSE, INFINITE);
return ReleaseMutex(*mutex) == 0 ? -1 : 0;
return WaitForSingleObject(*mutex, INFINITE) == WAIT_OBJECT_0? 0 : -1;
}
static int pthread_cond_signal(pthread_cond_t *cv) {