From 871ba5a488683055bcd556610bc974d94984f32f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 28 Dec 2016 21:47:04 +0100 Subject: thread/Cond: add timed_wait() overload with std::chrono support --- src/thread/WindowsCond.hxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/thread/WindowsCond.hxx') diff --git a/src/thread/WindowsCond.hxx b/src/thread/WindowsCond.hxx index 2ce7271b9..0419ee3c3 100644 --- a/src/thread/WindowsCond.hxx +++ b/src/thread/WindowsCond.hxx @@ -32,6 +32,8 @@ #include "CriticalSection.hxx" +#include + /** * Wrapper for a CONDITION_VARIABLE, backend for the Cond class. */ @@ -59,6 +61,12 @@ public: timeout_ms); } + bool timed_wait(CriticalSection &mutex, + std::chrono::steady_clock::duration timeout) { + auto timeout_ms = std::chrono::duration_cast(timeout).count(); + return timed_wait(mutex, timeout_ms); + } + void wait(CriticalSection &mutex) { timed_wait(mutex, INFINITE); } -- cgit v1.2.3