From 39968ccdba2e89d5b5490dab786d4ba309f6ca7e Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 30 Sep 2020 14:37:45 +0200 Subject: [PATCH] winmm: Remove unneeded TIME_TimeToDie, the thread ends when list is empty. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/winmm/time.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dlls/winmm/time.c b/dlls/winmm/time.c index 9bb948efbdd..814d97def0e 100644 --- a/dlls/winmm/time.c +++ b/dlls/winmm/time.c @@ -58,7 +58,6 @@ static CRITICAL_SECTION_DEBUG critsect_debug = static CRITICAL_SECTION TIME_cbcrst = { &critsect_debug, -1, 0, 0, 0, 0 }; static HANDLE TIME_hMMTimer; -static BOOL TIME_TimeToDie = TRUE; static CONDITION_VARIABLE TIME_cv; /* link timer at the appropriate spot in the list */ @@ -198,7 +197,7 @@ static DWORD CALLBACK TIME_MMSysTimeThread(LPVOID arg) TRACE("Starting main winmm thread\n"); EnterCriticalSection(&WINMM_cs); - while (! TIME_TimeToDie) + while (1) { sleep_time = TIME_MMSysTimeCallback(); @@ -228,7 +227,6 @@ static DWORD CALLBACK TIME_MMSysTimeThread(LPVOID arg) static void TIME_MMTimeStart(void) { HMODULE mod; - TIME_TimeToDie = 0; if (TIME_hMMTimer) return; GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)TIME_MMSysTimeThread, &mod); @@ -345,10 +343,8 @@ MMRESULT WINAPI timeKillEvent(UINT wID) break; } } - if (list_empty(&timer_list)) { - TIME_TimeToDie = 1; + if (list_empty(&timer_list)) WakeConditionVariable(&TIME_cv); - } LeaveCriticalSection(&WINMM_cs); if (!lpSelf)