diff --git a/lxsys.c.orig b/lxsys.c index 1ab89ba..bae667c 100644 --- lxsys.c.orig +++ lxsys.c @@ -24,6 +24,7 @@ #if DARWIN == 1 #include #include +#include #define TRUE_BSD FALSE #else #if (defined(__unix__) || defined(unix)) && !defined(USG) @@ -336,7 +337,17 @@ thread_pid[no]=no; thread_pid[no]=syscall(SYS_gettid); #else uint64_t thread_id; -pthread_threadid_np(NULL, &thread_id); +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 || defined(__POWERPC__) + thread_id = pthread_mach_thread_np(pthread_self()); +#elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060 + if (&pthread_threadid_np != NULL) { + pthread_threadid_np(NULL, &thread_id); + } else { + thread_id = pthread_mach_thread_np(pthread_self()); + } +#else + pthread_threadid_np(NULL, &thread_id); +#endif thread_pid[no]=(int)thread_id; #endif #endif