summaryrefslogtreecommitdiffstats
path: root/base/threading/platform_thread_posix.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/threading/platform_thread_posix.cc')
-rw-r--r--base/threading/platform_thread_posix.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
index 497acb5..baa3ab1 100644
--- a/base/threading/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -25,6 +25,10 @@
#include <unistd.h>
#endif
+#if defined(OS_ANDROID)
+#include "base/android/jni_android.h"
+#endif
+
#if defined(OS_NACL)
#include <sys/nacl_syscalls.h>
#endif
@@ -49,6 +53,9 @@ void* ThreadFunc(void* params) {
base::ThreadRestrictions::SetSingletonAllowed(false);
delete thread_params;
delegate->ThreadMain();
+#if defined(OS_ANDROID)
+ base::android::DetachFromVM();
+#endif
return NULL;
}
@@ -124,6 +131,8 @@ PlatformThreadId PlatformThread::CurrentId() {
return mach_thread_self();
#elif defined(OS_LINUX)
return syscall(__NR_gettid);
+#elif defined(OS_ANDROID)
+ return gettid();
#elif defined(OS_FREEBSD)
// TODO(BSD): find a better thread ID
return reinterpret_cast<int64>(pthread_self());