From efc1ea05d44ec4a1e5873bc37b90f515b647e46d Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 17 Nov 2026 09:10:37 +0100 Subject: [PATCH] Fix macOS detection Checking for __MACH__ is not enough, as that is defined for any OS that uses a (micro)kernel based on Mach (e.g. GNU/Hurd as well). The proper way to check for macOS is using __APPLE__, so adapt the existing branches to check that too. --- lightweightsemaphore.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightweightsemaphore.h b/lightweightsemaphore.h index c103068f..199f25fd 100644 --- a/lightweightsemaphore.h +++ b/lightweightsemaphore.h @@ -26,7 +26,7 @@ extern "C" { __declspec(dllimport) unsigned long __stdcall WaitForSingleObject(void* hHandle, unsigned long dwMilliseconds); __declspec(dllimport) int __stdcall ReleaseSemaphore(void* hSemaphore, long lReleaseCount, long* lpPreviousCount); } -#elif defined(__MACH__) +#elif defined(__MACH__) && defined(__APPLE__) #include #elif defined(__MVS__) #include @@ -118,7 +118,7 @@ class Semaphore while (!ReleaseSemaphore(m_hSema, count, nullptr)); } }; -#elif defined(__MACH__) +#elif defined(__MACH__) && defined(__APPLE__) //--------------------------------------------------------- // Semaphore (Apple iOS and OSX) // Can't use POSIX semaphores due to http://lists.apple.com/archives/darwin-kernel/2009/Apr/msg00010.html