diff --git a/base/logging.cpp b/base/logging.cpp index 6357b4ba7..75078e50e 100644 --- a/base/logging.cpp +++ b/base/logging.cpp @@ -80,7 +80,9 @@ static thread_id GetThreadId() { #if defined(__BIONIC__) return gettid(); #elif defined(__APPLE__) - return syscall(SYS_thread_selfid); + uint64_t tid; + pthread_threadid_np(NULL, &tid); + return tid; #elif defined(__linux__) return syscall(__NR_gettid); #elif defined(_WIN32) diff --git a/libcutils/threads.c b/libcutils/threads.c index 036f8c5b7..4bae39e0f 100644 --- a/libcutils/threads.c +++ b/libcutils/threads.c @@ -35,7 +35,9 @@ #ifndef __ANDROID__ pid_t gettid() { #if defined(__APPLE__) - return syscall(SYS_thread_selfid); + uint64_t tid; + pthread_threadid_np(NULL, &tid); + return tid; #elif defined(__linux__) return syscall(__NR_gettid); #elif defined(_WIN32)