diff options
author | Max Kellermann <max@musicpd.org> | 2017-12-16 20:50:53 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-12-16 20:56:06 +0100 |
commit | 6246d36fe6503e6bed3bca6aa5ca783c6188d76f (patch) | |
tree | 51521bbb43bc2bbbc34a14c393a0f65880aabbbc /src/thread | |
parent | fbc4bb29dcc471a08e47f10ffaa24ad8da6d40a2 (diff) | |
parent | f1ef9f9d31c71857db021029326715028a217906 (diff) |
Merge branch 'v0.20.x'
Diffstat (limited to 'src/thread')
-rw-r--r-- | src/thread/Cond.hxx | 2 | ||||
-rw-r--r-- | src/thread/Id.hxx | 12 | ||||
-rw-r--r-- | src/thread/Mutex.hxx | 2 | ||||
-rw-r--r-- | src/thread/Thread.cxx | 8 | ||||
-rw-r--r-- | src/thread/Thread.hxx | 10 | ||||
-rw-r--r-- | src/thread/Util.cxx | 4 |
6 files changed, 19 insertions, 19 deletions
diff --git a/src/thread/Cond.hxx b/src/thread/Cond.hxx index 3ca640ff1..7123635df 100644 --- a/src/thread/Cond.hxx +++ b/src/thread/Cond.hxx @@ -30,7 +30,7 @@ #ifndef THREAD_COND_HXX #define THREAD_COND_HXX -#ifdef WIN32 +#ifdef _WIN32 #include "WindowsCond.hxx" class Cond : public WindowsCond {}; diff --git a/src/thread/Id.hxx b/src/thread/Id.hxx index 217a39e72..17cdfa0d2 100644 --- a/src/thread/Id.hxx +++ b/src/thread/Id.hxx @@ -22,7 +22,7 @@ #include "Compiler.h" -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> #else #include <pthread.h> @@ -34,7 +34,7 @@ * debugging code. */ class ThreadId { -#ifdef WIN32 +#ifdef _WIN32 DWORD id; #else pthread_t id; @@ -46,7 +46,7 @@ public: */ ThreadId() noexcept = default; -#ifdef WIN32 +#ifdef _WIN32 constexpr ThreadId(DWORD _id) noexcept:id(_id) {} #else constexpr ThreadId(pthread_t _id) noexcept:id(_id) {} @@ -54,7 +54,7 @@ public: gcc_const static ThreadId Null() noexcept { -#ifdef WIN32 +#ifdef _WIN32 return 0; #else static ThreadId null; @@ -72,7 +72,7 @@ public: */ gcc_pure static const ThreadId GetCurrent() noexcept { -#ifdef WIN32 +#ifdef _WIN32 return ::GetCurrentThreadId(); #else return pthread_self(); @@ -81,7 +81,7 @@ public: gcc_pure bool operator==(const ThreadId &other) const noexcept { -#ifdef WIN32 +#ifdef _WIN32 return id == other.id; #else return pthread_equal(id, other.id); diff --git a/src/thread/Mutex.hxx b/src/thread/Mutex.hxx index 530ff9697..f1aa03cb2 100644 --- a/src/thread/Mutex.hxx +++ b/src/thread/Mutex.hxx @@ -32,7 +32,7 @@ #include <mutex> -#ifdef WIN32 +#ifdef _WIN32 #include "CriticalSection.hxx" class Mutex : public CriticalSection {}; diff --git a/src/thread/Thread.cxx b/src/thread/Thread.cxx index 3b6da667d..91b060628 100644 --- a/src/thread/Thread.cxx +++ b/src/thread/Thread.cxx @@ -30,7 +30,7 @@ Thread::Start() { assert(!IsDefined()); -#ifdef WIN32 +#ifdef _WIN32 handle = ::CreateThread(nullptr, 0, ThreadProc, this, 0, &id); if (handle == nullptr) throw MakeLastError("Failed to create thread"); @@ -61,7 +61,7 @@ Thread::Join() noexcept assert(IsDefined()); assert(!IsInside()); -#ifdef WIN32 +#ifdef _WIN32 ::WaitForSingleObject(handle, INFINITE); ::CloseHandle(handle); handle = nullptr; @@ -74,7 +74,7 @@ Thread::Join() noexcept inline void Thread::Run() noexcept { -#ifndef WIN32 +#ifndef _WIN32 #ifndef NDEBUG /* this works around a race condition that causes an assertion failure due to IsInside() spuriously returning false right @@ -91,7 +91,7 @@ Thread::Run() noexcept #endif } -#ifdef WIN32 +#ifdef _WIN32 DWORD WINAPI Thread::ThreadProc(LPVOID ctx) noexcept diff --git a/src/thread/Thread.hxx b/src/thread/Thread.hxx index cbf3310d0..d8bd1cfc7 100644 --- a/src/thread/Thread.hxx +++ b/src/thread/Thread.hxx @@ -24,7 +24,7 @@ #include "util/BindMethod.hxx" #include "Compiler.h" -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> #else #include <pthread.h> @@ -36,7 +36,7 @@ class Thread { typedef BoundMethod<void()> Function; const Function f; -#ifdef WIN32 +#ifdef _WIN32 HANDLE handle = nullptr; DWORD id; #else @@ -67,7 +67,7 @@ public: #endif bool IsDefined() const noexcept { -#ifdef WIN32 +#ifdef _WIN32 return handle != nullptr; #else return defined; @@ -79,7 +79,7 @@ public: */ gcc_pure bool IsInside() const noexcept { -#ifdef WIN32 +#ifdef _WIN32 return GetCurrentThreadId() == id; #else #ifdef NDEBUG @@ -96,7 +96,7 @@ public: private: void Run() noexcept; -#ifdef WIN32 +#ifdef _WIN32 static DWORD WINAPI ThreadProc(LPVOID ctx) noexcept; #else static void *ThreadProc(void *ctx) noexcept; diff --git a/src/thread/Util.cxx b/src/thread/Util.cxx index 34c6b5380..b336467bd 100644 --- a/src/thread/Util.cxx +++ b/src/thread/Util.cxx @@ -34,7 +34,7 @@ #include <sched.h> #include <sys/syscall.h> #include <unistd.h> -#elif defined(WIN32) +#elif defined(_WIN32) #include <windows.h> #endif @@ -71,7 +71,7 @@ SetThreadIdlePriority() noexcept ioprio_set_idle(); -#elif defined(WIN32) +#elif defined(_WIN32) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE); #endif }; |