[PATCH] quartz: Reset the advise thread's timeout on each iteration.
Gabriel Ivăncescu
gabrielopcode at gmail.com
Thu Jan 2 07:07:44 CST 2020
Fixes a regression introduced by
63a6b308e91232dd55dd107595a6181c70180dd4. Because the timeout value was
always shrinked, it quickly went to 0 and then the entire advise thread
used 100% of a CPU core in applications such as Media Player Classic by
basically becoming a busy loop.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
As I seem to understand, this code is supposed to get the minimum timeout of
all the sinks in the list, but only for that specific iteration, not globally.
dlls/quartz/systemclock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/systemclock.c b/dlls/quartz/systemclock.c
index 77e569d..8122cc5 100644
--- a/dlls/quartz/systemclock.c
+++ b/dlls/quartz/systemclock.c
@@ -126,13 +126,14 @@ static DWORD WINAPI SystemClockAdviseThread(void *param)
struct system_clock *clock = param;
struct advise_sink *sink, *cursor;
REFERENCE_TIME current_time;
- DWORD timeout = INFINITE;
HANDLE handles[2] = {clock->stop_event, clock->notify_event};
TRACE("Starting advise thread for clock %p.\n", clock);
for (;;)
{
+ DWORD timeout = INFINITE;
+
EnterCriticalSection(&clock->cs);
current_time = GetTickCount64() * 10000;
--
2.21.0
More information about the wine-devel
mailing list