summaryrefslogtreecommitdiffstats
path: root/src/OSSupport
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-07 21:37:47 +0100
committerMattes D <github@xoft.cz>2014-12-07 21:37:47 +0100
commitc65bb6341dfc25ae937bd12c9e41855fb27fdccb (patch)
tree4c2596b52bdc02c964e08cb4473fe061822e8a0b /src/OSSupport
parentMerge remote-tracking branch 'origin/master' into c++11Events (diff)
downloadcuberite-c65bb6341dfc25ae937bd12c9e41855fb27fdccb.tar
cuberite-c65bb6341dfc25ae937bd12c9e41855fb27fdccb.tar.gz
cuberite-c65bb6341dfc25ae937bd12c9e41855fb27fdccb.tar.bz2
cuberite-c65bb6341dfc25ae937bd12c9e41855fb27fdccb.tar.lz
cuberite-c65bb6341dfc25ae937bd12c9e41855fb27fdccb.tar.xz
cuberite-c65bb6341dfc25ae937bd12c9e41855fb27fdccb.tar.zst
cuberite-c65bb6341dfc25ae937bd12c9e41855fb27fdccb.zip
Diffstat (limited to 'src/OSSupport')
-rw-r--r--src/OSSupport/Event.cpp6
-rw-r--r--src/OSSupport/Event.h2
2 files changed, 4 insertions, 4 deletions
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<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))
{
diff --git a/src/OSSupport/Event.h b/src/OSSupport/Event.h
index 5818115be..572388a3f 100644
--- a/src/OSSupport/Event.h
+++ b/src/OSSupport/Event.h
@@ -32,7 +32,7 @@ public:
/** Waits for the event until either it is signalled, or the (relative) timeout is passed.
Returns true if the event was signalled, false if the timeout was hit or there was an error. */
- bool Wait(int a_TimeoutMSec);
+ bool Wait(unsigned a_TimeoutMSec);
private: