[PATCH 4/5] quartz/systemclock: Also wake the semaphore at the given start time.

Zebediah Figura z.figura12 at gmail.com
Thu Mar 14 19:11:00 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/quartz/systemclock.c       | 4 ++--
 dlls/quartz/tests/systemclock.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/quartz/systemclock.c b/dlls/quartz/systemclock.c
index 8291fe5fb2..c445f57ff7 100644
--- a/dlls/quartz/systemclock.c
+++ b/dlls/quartz/systemclock.c
@@ -106,11 +106,11 @@ static DWORD WINAPI SystemClockAdviseThread(LPVOID lpParam) {
     {
       if (sink->rtBaseTime <= curTime)
       {
-        DWORD periods = (curTime - sink->rtBaseTime) / sink->rtIntervalTime;
+        DWORD periods = ((curTime - sink->rtBaseTime) / sink->rtIntervalTime) + 1;
         ReleaseSemaphore(sink->hEvent, periods, NULL);
         sink->rtBaseTime += periods * sink->rtIntervalTime;
       }
-      timeOut = min(timeOut, ((sink->rtBaseTime + sink->rtIntervalTime) - curTime) / 10000);
+      timeOut = min(timeOut, (sink->rtBaseTime - curTime) / 10000);
     }
 
     LeaveCriticalSection(&This->safe);
diff --git a/dlls/quartz/tests/systemclock.c b/dlls/quartz/tests/systemclock.c
index 77e6c63001..cd291e1490 100644
--- a/dlls/quartz/tests/systemclock.c
+++ b/dlls/quartz/tests/systemclock.c
@@ -160,7 +160,7 @@ static void test_advise(void)
 
     hr = IReferenceClock_AdvisePeriodic(clock, current, 500 * 10000, (HSEMAPHORE)semaphore, &cookie);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(!WaitForSingleObject(semaphore, 10), "Semaphore should be signaled.\n");
+    ok(!WaitForSingleObject(semaphore, 10), "Semaphore should be signaled.\n");
     for (i = 0; i < 5; ++i)
     {
         ok(WaitForSingleObject(semaphore, 480) == WAIT_TIMEOUT, "Semaphore should not be signaled.\n");
-- 
2.20.1




More information about the wine-devel mailing list