diff --git a/alc/alc.cpp b/alc/alc.cpp index e84b26e5..30d363af 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -22,6 +22,11 @@ #include "version.h" +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif + #include #include #include diff --git a/common/threads.cpp b/common/threads.cpp index ff01de42..e3b715f0 100644 --- a/common/threads.cpp +++ b/common/threads.cpp @@ -20,12 +20,15 @@ #include "config.h" +#include "opthelpers.h" #include "threads.h" #include #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include #include @@ -73,15 +76,15 @@ semaphore::~semaphore() void semaphore::post() { - if(!ReleaseSemaphore(mSem, 1, nullptr)) + if UNLIKELY(!ReleaseSemaphore(static_cast(mSem), 1, nullptr)) throw std::system_error(std::make_error_code(std::errc::value_too_large)); } void semaphore::wait() noexcept -{ WaitForSingleObject(mSem, INFINITE); } +{ WaitForSingleObject(static_cast(mSem), INFINITE); } bool semaphore::try_wait() noexcept -{ return WaitForSingleObject(mSem, 0) == WAIT_OBJECT_0; } +{ return WaitForSingleObject(static_cast(mSem), 0) == WAIT_OBJECT_0; } } // namespace al diff --git a/common/threads.h b/common/threads.h index ff571a66..1cdb5d8f 100644 --- a/common/threads.h +++ b/common/threads.h @@ -11,12 +11,9 @@ #define FORCE_ALIGN #endif -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#elif defined(__APPLE__) +#if defined(__APPLE__) #include -#else +#elif !defined(_WIN32) #include #endif @@ -26,7 +23,7 @@ namespace al { class semaphore { #ifdef _WIN32 - using native_type = HANDLE; + using native_type = void*; #elif defined(__APPLE__) using native_type = dispatch_semaphore_t; #else