From c65bb6341dfc25ae937bd12c9e41855fb27fdccb Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 7 Dec 2014 21:37:47 +0100 Subject: Fixed integer overflow problems. The event would overflow when requesting a 60 minute timeout. --- src/OSSupport/Event.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/OSSupport/Event.cpp') diff --git a/src/OSSupport/Event.cpp b/src/OSSupport/Event.cpp index d519ad63f..d6ba937f9 100644 --- a/src/OSSupport/Event.cpp +++ b/src/OSSupport/Event.cpp @@ -35,11 +35,11 @@ void cEvent::Wait(void) -bool cEvent::Wait(int a_TimeoutMSec) +bool cEvent::Wait(unsigned a_TimeoutMSec) { - std::chrono::system_clock::time_point dst = std::chrono::system_clock::now() + std::chrono::microseconds(a_TimeoutMSec * 1000); + auto dst = std::chrono::system_clock::now() + std::chrono::milliseconds(a_TimeoutMSec); std::unique_lock Lock(m_Mutex); // We assume that this lock is acquired without much delay - we are the only user of the mutex - while (m_ShouldWait && (std::chrono::system_clock::now() < dst)) + while (m_ShouldWait && (std::chrono::system_clock::now() <= dst)) { switch (m_CondVar.wait_until(Lock, dst)) { -- cgit v1.2.3