diff options
-rw-r--r-- | cmake/GlobalConfig.cmake | 4 | ||||
-rw-r--r-- | src/armnnUtils/Threads.cpp | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/cmake/GlobalConfig.cmake b/cmake/GlobalConfig.cmake index 60b6a3dae6..142e536912 100644 --- a/cmake/GlobalConfig.cmake +++ b/cmake/GlobalConfig.cmake @@ -37,7 +37,9 @@ option(BUILD_PYTHON_SRC "Build Python source package" OFF) include(SelectLibraryConfigurations) set(COMPILER_IS_GNU_LIKE 0) -if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU OR ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) +if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU OR + ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang OR + ${CMAKE_CXX_COMPILER_ID} STREQUAL AppleClang) set(COMPILER_IS_GNU_LIKE 1) endif() diff --git a/src/armnnUtils/Threads.cpp b/src/armnnUtils/Threads.cpp index 561edcb8b7..0ca1adf0c3 100644 --- a/src/armnnUtils/Threads.cpp +++ b/src/armnnUtils/Threads.cpp @@ -11,6 +11,11 @@ #define gettid() syscall(SYS_gettid) #elif defined(_MSC_VER) #include "WindowsWrapper.hpp" +#elif defined(__APPLE__) +#include "AvailabilityMacros.h" +#include <sys/syscall.h> +#include <sys/time.h> +#include <unistd.h> #endif namespace armnnUtils @@ -24,6 +29,14 @@ int GetCurrentThreadId() return static_cast<int>(gettid()); #elif defined(_MSC_VER) return ::GetCurrentThreadId(); +#elif defined(__APPLE__) + uint64_t threadId; + int iRet = pthread_threadid_np(NULL, &threadId); + if (iRet != 0) + { + return 0; + } + return threadId; #endif } |