diff options
author | Venkatarama NG. Avadhani <venkatarama.avadhani@ittiam.com> | 2018-09-05 10:35:04 +0530 |
---|---|---|
committer | Venkatarama NG. Avadhani <venkatarama.avadhani@ittiam.com> | 2018-09-12 12:04:55 +0530 |
commit | bf6299010e815e111d7326530c249e9d99611f34 (patch) | |
tree | 8d0a0a47263639b59f6b4f8b15172be4afd1881b /vpx_util/vpx_thread.h | |
parent | ba1c053df90386696c846807f17375ba8622e6f1 (diff) | |
download | libvpx-bf6299010e815e111d7326530c249e9d99611f34.tar libvpx-bf6299010e815e111d7326530c249e9d99611f34.tar.gz libvpx-bf6299010e815e111d7326530c249e9d99611f34.tar.bz2 libvpx-bf6299010e815e111d7326530c249e9d99611f34.zip |
Revert "Revert "Loopfilter MultiThread Optimization""
This reverts commit 753fd86e86ac727dccac88376260b8f54502f2a3.
This also has the fix for the DoS reported in bug 1558.
BUG=webm:1558
Change-Id: I65ea84e0c11d6bd40d8cb0587dfe934b3ac11dce
Diffstat (limited to 'vpx_util/vpx_thread.h')
-rw-r--r-- | vpx_util/vpx_thread.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vpx_util/vpx_thread.h b/vpx_util/vpx_thread.h index 53a5f4966..013a6179e 100644 --- a/vpx_util/vpx_thread.h +++ b/vpx_util/vpx_thread.h @@ -159,6 +159,23 @@ static INLINE int pthread_cond_init(pthread_cond_t *const condition, return 0; } +static INLINE int pthread_cond_broadcast(pthread_cond_t *const condition) { + int ok = 1; +#ifdef USE_WINDOWS_CONDITION_VARIABLE + WakeAllConditionVariable(condition); +#else + while (WaitForSingleObject(condition->waiting_sem_, 0) == WAIT_OBJECT_0) { + // a thread is waiting in pthread_cond_wait: allow it to be notified + ok &= SetEvent(condition->signal_event_); + // wait until the event is consumed so the signaler cannot consume + // the event via its own pthread_cond_wait. + ok &= (WaitForSingleObject(condition->received_sem_, INFINITE) != + WAIT_OBJECT_0); + } +#endif + return !ok; +} + static INLINE int pthread_cond_signal(pthread_cond_t *const condition) { int ok = 1; #ifdef USE_WINDOWS_CONDITION_VARIABLE |