Commit 01eb9805 authored by Sergey Radionov's avatar Sergey Radionov Committed by Ronald S. Bultje

w32thread: call ResetEvent() in pthread_cond_broadcast().

Also add "volatile" to broadcast flag (since it is used from
multiple threads).
Signed-off-by: 's avatarRonald S. Bultje <rsbultje@gmail.com>
parent 4e8d6218
...@@ -120,7 +120,7 @@ typedef struct { ...@@ -120,7 +120,7 @@ typedef struct {
volatile int waiter_count; volatile int waiter_count;
HANDLE semaphore; HANDLE semaphore;
HANDLE waiters_done; HANDLE waiters_done;
int is_broadcast; volatile int is_broadcast;
} win32_cond_t; } win32_cond_t;
static void pthread_cond_init(pthread_cond_t *cond, const void *unused_attr) static void pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
...@@ -187,6 +187,7 @@ static void pthread_cond_broadcast(pthread_cond_t *cond) ...@@ -187,6 +187,7 @@ static void pthread_cond_broadcast(pthread_cond_t *cond)
ReleaseSemaphore(win32_cond->semaphore, win32_cond->waiter_count, NULL); ReleaseSemaphore(win32_cond->semaphore, win32_cond->waiter_count, NULL);
pthread_mutex_unlock(&win32_cond->mtx_waiter_count); pthread_mutex_unlock(&win32_cond->mtx_waiter_count);
WaitForSingleObject(win32_cond->waiters_done, INFINITE); WaitForSingleObject(win32_cond->waiters_done, INFINITE);
ResetEvent(win32_cond->waiters_done);
win32_cond->is_broadcast = 0; win32_cond->is_broadcast = 0;
} else } else
pthread_mutex_unlock(&win32_cond->mtx_waiter_count); pthread_mutex_unlock(&win32_cond->mtx_waiter_count);
......
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