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/threads.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/threads.h')
-rw-r--r-- | src/threads.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/threads.h b/src/threads.h index d4306f631..ce98593cd 100644 --- a/src/threads.h +++ b/src/threads.h @@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define THREADS_HEADER // -// Determine which threading API we will use +// Determine which threading APIs we will use // #if __cplusplus >= 201103L #define USE_CPP11_THREADS 1 @@ -31,11 +31,27 @@ with this program; if not, write to the Free Software Foundation, Inc., #define USE_POSIX_THREADS 1 #endif +#if defined(_WIN32) + // Prefer critical section API because std::mutex is much slower on Windows + #define USE_WIN_MUTEX 1 +#elif __cplusplus >= 201103L + #define USE_CPP11_MUTEX 1 +#else + #define USE_POSIX_MUTEX 1 +#endif + /////////////// #if USE_CPP11_THREADS #include <thread> +#elif USE_POSIX_THREADS + #include <pthread.h> +#else + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include <windows.h> #endif #include "threading/mutex.h" |