From c41e5fd05d12988696912738467c298e1b87954d Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 3 Apr 2023 17:35:16 +0200 Subject: [PATCH] Support multiple redundant Timer#Start() calls so that only the first one changes l_AliveTimers (as in Timer#Stop()). --- lib/base/timer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/base/timer.cpp b/lib/base/timer.cpp index 0b56321f7..ffe1c39d8 100644 --- a/lib/base/timer.cpp +++ b/lib/base/timer.cpp @@ -162,12 +162,13 @@ double Timer::GetInterval() const void Timer::Start() { std::unique_lock lock(l_TimerMutex); - m_Started = true; - if (++l_AliveTimers == 1) { + if (!m_Started && ++l_AliveTimers == 1) { InitializeThread(); } + m_Started = true; + InternalRescheduleUnlocked(false, m_Interval > 0 ? -1 : m_Next); }