diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/threads.cpp | 3 | ||||
-rw-r--r-- | common/threads.h | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/common/threads.cpp b/common/threads.cpp index 136c4813..76a13d9d 100644 --- a/common/threads.cpp +++ b/common/threads.cpp @@ -128,7 +128,8 @@ void althrd_setname(const char *name [[maybe_unused]]) #endif } -#ifdef __APPLE__ +/* Do not try using libdispatch on systems where it is absent. */ +#if defined(__APPLE__) && ((MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__)) namespace al { diff --git a/common/threads.h b/common/threads.h index 59fccd12..2592e5b0 100644 --- a/common/threads.h +++ b/common/threads.h @@ -15,7 +15,12 @@ #endif #if defined(__APPLE__) +#include <AvailabilityMacros.h> +#if (MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__) #include <dispatch/dispatch.h> +#else +#include <semaphore.h> /* Fallback option for Apple without a working libdispatch */ +#endif #elif !defined(_WIN32) #include <semaphore.h> #endif @@ -27,7 +32,7 @@ namespace al { class semaphore { #ifdef _WIN32 using native_type = void*; -#elif defined(__APPLE__) +#elif defined(__APPLE__) && ((MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__)) using native_type = dispatch_semaphore_t; #else using native_type = sem_t; |