From 6ebefaae2072d70c2ca733402545fcc7775ad978 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 11 May 2022 11:50:49 +0200 Subject: Minor tweaks to own C++14 threads implementation on MinGW --- libbutl/mingw-condition_variable.hxx | 8 ++++++++ libbutl/mingw-mutex.hxx | 5 ----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libbutl/mingw-condition_variable.hxx b/libbutl/mingw-condition_variable.hxx index ce94941..965f533 100644 --- a/libbutl/mingw-condition_variable.hxx +++ b/libbutl/mingw-condition_variable.hxx @@ -126,9 +126,17 @@ public: const std::chrono::duration& rel_time, Predicate pred) { +#if __cplusplus >= 201703L + using steady_duration = typename std::chrono::steady_clock::duration; + return wait_until(lock, + std::chrono::steady_clock::now() + + std::chrono::ceil (rel_time), + std::move(pred)); +#else return wait_until(lock, std::chrono::steady_clock::now() + rel_time, std::move(pred)); +#endif } template cv_status wait_until (unique_lock& lock, diff --git a/libbutl/mingw-mutex.hxx b/libbutl/mingw-mutex.hxx index 375a572..d297786 100644 --- a/libbutl/mingw-mutex.hxx +++ b/libbutl/mingw-mutex.hxx @@ -81,11 +81,6 @@ namespace mingw_stdthread // Slim Reader-Writer (SRW)-based implementation that requires Windows 7. // -#if !defined(SRWLOCK_INIT) -#error SRWLOCK_INIT macro is not defined -//#define SRWLOCK_INIT {0} -#endif - class mutex { protected: -- cgit v1.1