diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-05-10 09:48:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-05-10 09:48:08 +0200 |
commit | ea2b4fb4935627e4dea48f193eeb0019155a3abe (patch) | |
tree | 8dd1bbecf9ff634616d7b2717f7b46fcc64fc364 /libbutl/process-details.hxx | |
parent | 3cb2d76c1e2375ecce69f2c3f462be979295c753 (diff) |
Use our own implementation of C++14 threads on MinGWmingw-stdthread
Diffstat (limited to 'libbutl/process-details.hxx')
-rw-r--r-- | libbutl/process-details.hxx | 27 |
1 files changed, 22 insertions, 5 deletions
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 <libbutl/ft/shared_mutex.hxx> +#ifdef LIBBUTL_MINGW_STDTHREAD -#include <mutex> -#if defined(__cpp_lib_shared_mutex) || defined(__cpp_lib_shared_timed_mutex) -# include <shared_mutex> -#endif +# include <libbutl/mingw-shared_mutex.hxx> + +namespace butl +{ + using shared_mutex = mingw_stdthread::shared_mutex; + using ulock = mingw_stdthread::unique_lock<shared_mutex>; + using slock = mingw_stdthread::shared_lock<shared_mutex>; +} + +#else // LIBBUTL_MINGW_STDTHREADS + +# include <libbutl/ft/shared_mutex.hxx> + +# include <mutex> +# if defined(__cpp_lib_shared_mutex) || defined(__cpp_lib_shared_timed_mutex) +# include <shared_mutex> +# endif namespace butl { @@ -36,7 +49,11 @@ namespace butl using ulock = std::unique_lock<shared_mutex>; 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. |