[core,timer] ensure all scheduled timers are handled

Timers might be delayed, so loop over all expired timers until none are
left.
This commit is contained in:
akallabeth
2025-10-20 21:53:09 +02:00
parent 1f03566604
commit 3975fe7c25

View File

@@ -190,8 +190,6 @@ static uint64_t expire_and_reschedule(FreeRDPTimer* timer)
}
ArrayList_Unlock(timer->entries);
if (next == UINT64_MAX)
return 0;
return next;
}
@@ -210,12 +208,17 @@ static DWORD WINAPI timer_thread(LPVOID arg)
(void)ResetEvent(timer->event);
const uint64_t next = expire_and_reschedule(timer);
const uint64_t now = winpr_GetTickCount64NS();
if (now >= next)
if (next == UINT64_MAX)
{
timeout = INFINITE;
continue;
}
if (next <= now)
{
timeout = 0;
continue;
}
const uint64_t diff = next - now;
const uint64_t diffMS = diff / 1000000ull;
timeout = INFINITE;