mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
Fix pthread_cond_wait() to prevent race
This commit is contained in:
1 parent
4619c1a71e
commit
6a43bd952f
1 file changed
+1
-1
+1
-1
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user