diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/thread.cpp | 17 | ||||
| -rw-r--r-- | src/common/thread.h | 16 |
2 files changed, 15 insertions, 18 deletions
diff --git a/src/common/thread.cpp b/src/common/thread.cpp index 8bf005857..7bbf080bc 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp | |||
| @@ -5,11 +5,20 @@ | |||
| 5 | #include "common/thread.h" | 5 | #include "common/thread.h" |
| 6 | 6 | ||
| 7 | #ifdef __APPLE__ | 7 | #ifdef __APPLE__ |
| 8 | #include <mach/mach.h> | 8 | #include <mach/mach.h> |
| 9 | #elif defined(BSD4_4) || defined(__OpenBSD__) | ||
| 10 | #include <pthread_np.h> | ||
| 11 | #elif defined(_WIN32) | 9 | #elif defined(_WIN32) |
| 12 | #include <Windows.h> | 10 | #include <Windows.h> |
| 11 | #else | ||
| 12 | #if defined(BSD4_4) || defined(__OpenBSD__) | ||
| 13 | #include <pthread_np.h> | ||
| 14 | #else | ||
| 15 | #include <pthread.h> | ||
| 16 | #endif | ||
| 17 | #include <sched.h> | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #ifndef _WIN32 | ||
| 21 | #include <unistd.h> | ||
| 13 | #endif | 22 | #endif |
| 14 | 23 | ||
| 15 | namespace Common | 24 | namespace Common |
diff --git a/src/common/thread.h b/src/common/thread.h index 7bc419497..8255ee6d3 100644 --- a/src/common/thread.h +++ b/src/common/thread.h | |||
| @@ -4,24 +4,12 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include <cstddef> |
| 8 | #include <cstdio> | ||
| 9 | #include <cstring> | ||
| 10 | #include <thread> | 8 | #include <thread> |
| 11 | #include <condition_variable> | 9 | #include <condition_variable> |
| 12 | #include <mutex> | 10 | #include <mutex> |
| 13 | 11 | ||
| 14 | // This may not be defined outside _WIN32 | 12 | #include "common/common_types.h" |
| 15 | #ifndef _WIN32 | ||
| 16 | #ifndef INFINITE | ||
| 17 | #define INFINITE 0xffffffff | ||
| 18 | #endif | ||
| 19 | |||
| 20 | //for gettimeofday and struct time(spec|val) | ||
| 21 | #include <time.h> | ||
| 22 | #include <sys/time.h> | ||
| 23 | #include <unistd.h> | ||
| 24 | #endif | ||
| 25 | 13 | ||
| 26 | // Support for C++11's thread_local keyword was surprisingly spotty in compilers until very | 14 | // Support for C++11's thread_local keyword was surprisingly spotty in compilers until very |
| 27 | // recently. Fortunately, thread local variables have been well supported for compilers for a while, | 15 | // recently. Fortunately, thread local variables have been well supported for compilers for a while, |