Merge "libcutils: Fix thread ID on macOS" am: 6958506e82
am: bdee15ef71
Change-Id: Iac6a73e1b7dfb387cd53798824575ca29b24ee04
diff --git a/base/logging.cpp b/base/logging.cpp
index 6357b4b..75078e5 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -80,7 +80,9 @@
#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 036f8c5..4bae39e 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)