Commit 6a43bd95 authored by Sergey Lyubka's avatar Sergey Lyubka

Fix pthread_cond_wait() to prevent race

parent 4619c1a7
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment