diff options
author | est31 <MTest31@outlook.com> | 2016-12-22 23:16:00 +0100 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2016-12-22 23:16:00 +0100 |
commit | 81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (patch) | |
tree | 1e9ef1be1b3295a8673d6e4f0bdeb4c2d3a6015f /src/threading/mutex.h | |
parent | 8077612dcb48221281e726a60eb97bf73fde462b (diff) | |
parent | 231ac33d34dfaaddf292c5f31b1eae43eeefba2d (diff) | |
download | minetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.tar.gz minetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.tar.bz2 minetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.zip |
Merge 0.4.15 changes into stable-0.4
0.4.15 release!
Diffstat (limited to 'src/threading/mutex.h')
-rw-r--r-- | src/threading/mutex.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/threading/mutex.h b/src/threading/mutex.h index dadbd050c..fb5c029fc 100644 --- a/src/threading/mutex.h +++ b/src/threading/mutex.h @@ -26,14 +26,15 @@ DEALINGS IN THE SOFTWARE. #ifndef THREADING_MUTEX_H #define THREADING_MUTEX_H -// Windows std::mutex is much slower than the critical section API -#if __cplusplus >= 201103L && !defined(_WIN32) +#include "threads.h" + +#if USE_CPP11_MUTEX #include <mutex> using Mutex = std::mutex; using RecursiveMutex = std::recursive_mutex; #else -#ifdef _WIN32 +#if USE_WIN_MUTEX #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0501 #endif @@ -41,7 +42,7 @@ DEALINGS IN THE SOFTWARE. #define WIN32_LEAN_AND_MEAN #endif #include <windows.h> -#else // pthread +#else #include <pthread.h> #endif @@ -59,9 +60,9 @@ protected: Mutex(bool recursive); void init_mutex(bool recursive); private: -#ifdef _WIN32 +#if USE_WIN_MUTEX CRITICAL_SECTION mutex; -#else // pthread +#else pthread_mutex_t mutex; #endif @@ -76,6 +77,6 @@ public: DISABLE_CLASS_COPY(RecursiveMutex); }; -#endif // C++11 +#endif // C++11 #endif |