From ea2b4fb4935627e4dea48f193eeb0019155a3abe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 10 May 2022 09:48:08 +0200 Subject: Use our own implementation of C++14 threads on MinGW --- libbutl/process-details.hxx | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'libbutl/process-details.hxx') diff --git a/libbutl/process-details.hxx b/libbutl/process-details.hxx index 571c750..10d5241 100644 --- a/libbutl/process-details.hxx +++ b/libbutl/process-details.hxx @@ -3,12 +3,25 @@ #pragma once -#include +#ifdef LIBBUTL_MINGW_STDTHREAD -#include -#if defined(__cpp_lib_shared_mutex) || defined(__cpp_lib_shared_timed_mutex) -# include -#endif +# include + +namespace butl +{ + using shared_mutex = mingw_stdthread::shared_mutex; + using ulock = mingw_stdthread::unique_lock; + using slock = mingw_stdthread::shared_lock; +} + +#else // LIBBUTL_MINGW_STDTHREADS + +# include + +# include +# if defined(__cpp_lib_shared_mutex) || defined(__cpp_lib_shared_timed_mutex) +# include +# endif namespace butl { @@ -36,7 +49,11 @@ namespace butl using ulock = std::unique_lock; using slock = ulock; #endif +} +#endif // LIBBUTL_MINGW_STDTHREADS +namespace butl +{ // Mutex that is acquired to make a sequence of operations atomic in regards // to child process spawning. Must be aquired for exclusive access for child // process startup, and for shared access otherwise. Defined in process.cxx. -- cgit v1.1