Index: src/base/platform/platform-posix.cc |
diff --git a/src/base/platform/platform-posix.cc b/src/base/platform/platform-posix.cc |
index 8454213def9308ef2d89e9b758f506af764e330c..b49e7bf856296d2fa789ca59afadc0d70ec9715a 100644 |
--- a/src/base/platform/platform-posix.cc |
+++ b/src/base/platform/platform-posix.cc |
@@ -20,9 +20,9 @@ |
#include <sys/mman.h> |
#include <sys/resource.h> |
#include <sys/stat.h> |
+#include <sys/syscall.h> |
#include <sys/time.h> |
#include <sys/types.h> |
- |
#if defined(__linux__) |
#include <sys/prctl.h> // NOLINT, for prctl |
#endif |
@@ -318,6 +318,15 @@ int OS::GetCurrentProcessId() { |
} |
+int OS::GetCurrentThreadId() { |
+#if defined(ANDROID) |
+ return static_cast<int>(syscall(__NR_gettid)); |
+#else |
+ return static_cast<int>(syscall(SYS_gettid)); |
+#endif // defined(ANDROID) |
+} |
+ |
+ |
// ---------------------------------------------------------------------------- |
// POSIX date/time support. |
// |