summaryrefslogtreecommitdiff
path: root/libavcodec/w32pthreads.h
diff options
context:
space:
mode:
authorSergey Radionov <rsatom@gmail.com>2011-12-23 10:37:48 +0700
committerRonald S. Bultje <rsbultje@gmail.com>2011-12-22 19:48:52 -0800
commit01eb9805f37835e20501134ae26e379140fe3239 (patch)
tree0a26ae77df8751b85f2e3d4025d52127e80c3abe /libavcodec/w32pthreads.h
parent4e8d6218c3cb8b9feffb70f8a53859540b975b36 (diff)
w32thread: call ResetEvent() in pthread_cond_broadcast().
Also add "volatile" to broadcast flag (since it is used from multiple threads). Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/w32pthreads.h')
-rw-r--r--libavcodec/w32pthreads.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/w32pthreads.h b/libavcodec/w32pthreads.h
index 3cdbc2c343..70b84cf2e1 100644
--- a/libavcodec/w32pthreads.h
+++ b/libavcodec/w32pthreads.h
@@ -120,7 +120,7 @@ typedef struct {
volatile int waiter_count;
HANDLE semaphore;
HANDLE waiters_done;
- int is_broadcast;
+ volatile int is_broadcast;
} win32_cond_t;
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)
ReleaseSemaphore(win32_cond->semaphore, win32_cond->waiter_count, NULL);
pthread_mutex_unlock(&win32_cond->mtx_waiter_count);
WaitForSingleObject(win32_cond->waiters_done, INFINITE);
+ ResetEvent(win32_cond->waiters_done);
win32_cond->is_broadcast = 0;
} else
pthread_mutex_unlock(&win32_cond->mtx_waiter_count);