From cd781b1511d437816aac65f89646bd80dbf7c040 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 28 May 2023 14:28:00 +0800 Subject: [PATCH 2/2] threads: do not use libdispatch where it is not present (#851) Fixes: https://github.com/kcat/openal-soft/issues/850 --- common/threads.cpp | 3 ++- common/threads.h | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git common/threads.cpp common/threads.cpp index 136c4813..76a13d9d 100644 --- common/threads.cpp +++ 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 common/threads.h common/threads.h index 59fccd12..2592e5b0 100644 --- common/threads.h +++ common/threads.h @@ -15,7 +15,12 @@ #endif #if defined(__APPLE__) +#include +#if (MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__) #include +#else +#include /* Fallback option for Apple without a working libdispatch */ +#endif #elif !defined(_WIN32) #include #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; -- 2.40.1