diff --git a/build/patches/win/APR/locks/win32/thread_cond.c b/build/patches/win/APR/locks/win32/thread_cond.c old mode 100644 new mode 100755 index 09a5e16..59bb28e --- a/build/patches/win/APR/locks/win32/thread_cond.c +++ b/build/patches/win/APR/locks/win32/thread_cond.c @@ -63,6 +63,11 @@ static APR_INLINE apr_status_t _thread_c res = WaitForSingleObject(cond->event, timeout_ms); apr_thread_mutex_lock(mutex); cond->num_waiting--; + // all waiter are notified => reset event + if (cond->num_waiting == 0) { + ResetEvent(cond->event); + } + if (res != WAIT_OBJECT_0) { apr_status_t rv = apr_get_os_error(); if (res == WAIT_TIMEOUT) { @@ -74,9 +79,7 @@ static APR_INLINE apr_status_t _thread_c if (cond->num_waiting == 0) { cond->signal_all = 0; cond->signalled = 0; - ResetEvent(cond->event); } - // wait till all NOT_STALLED wait procceed and reset the event // then continue waiting while (!NOT_STALED(this_wait_level, cond->notify_level) && cond->num_waiting != 0) { @@ -88,13 +91,14 @@ static APR_INLINE apr_status_t _thread_c if(NOT_STALED(this_wait_level, cond->notify_level)) { break; } - - } - else if (cond->signalled && NOT_STALED(this_wait_level, cond->notify_level)) { - cond->signalled = 0; - ResetEvent(cond->event); - break; - } + } else { + if (cond->signalled) { + if(NOT_STALED(this_wait_level, cond->notify_level)) { + cond->signalled = 0; + break; + } + } + } } return APR_SUCCESS; }