From 3c7e440391d36e93d8aaa68464a67dc9d6983ad8 Mon Sep 17 00:00:00 2001 From: "jochen@chromium.org" Date: Fri, 10 Oct 2014 07:22:57 +0000 Subject: [PATCH] Sync OS::GetCurrentThreadId with chromium's/blink's implementation Compare third_party/WebKit/Source/wtf/ThreadingPthreads.cpp BUG=v8:3620 R=svenpanne@chromium.org LOG=n Review URL: https://codereview.chromium.org/649553002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24511 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/base/platform/platform-posix.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/base/platform/platform-posix.cc b/src/base/platform/platform-posix.cc index 0fc04fc110..cd7e09a39e 100644 --- a/src/base/platform/platform-posix.cc +++ b/src/base/platform/platform-posix.cc @@ -253,14 +253,14 @@ int OS::GetCurrentProcessId() { int OS::GetCurrentThreadId() { -#if defined(ANDROID) +#if V8_OS_MACOSX + return static_cast(pthread_mac_thread_np(pthread_self())); +#elif V8_OS_LINUX return static_cast(syscall(__NR_gettid)); -#elif defined(SYS_gettid) - return static_cast(syscall(SYS_gettid)); +#elif V8_OS_ANDROID + return static_cast(gettid()); #else - // PNaCL doesn't have a way to get an integral thread ID, but it doesn't - // really matter, because we only need it in PerfJitLogger::LogRecordedBuffer. - return 0; + return reinterpret_cast(pthread_self()); #endif }