1
0

Fixed integer overflow problems.

The event would overflow when requesting a 60 minute timeout.
This commit is contained in:
Mattes D
2014-12-07 21:37:47 +01:00
parent 8ad1afcc1b
commit c65bb6341d
2 changed files with 4 additions and 4 deletions

View File

@@ -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<std::mutex> 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))
{