From 758c614f0a3eea6c95a7c2e6f9e03ddca6e5ae6a Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 19 Jul 2015 16:21:24 +0200 Subject: [PATCH] Set threadnames on Android --- thread/threadutil.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/thread/threadutil.cpp b/thread/threadutil.cpp index 6dcaa4369d..c0ff13f044 100644 --- a/thread/threadutil.cpp +++ b/thread/threadutil.cpp @@ -9,6 +9,10 @@ #include "base/logging.h" #include "thread/threadutil.h" +#ifdef ANDROID +#include +#endif + #ifdef TLS_SUPPORTED static __THREAD const char *curThreadName; #endif @@ -38,6 +42,13 @@ void setCurrentThreadName(const char* threadName) { __except(EXCEPTION_CONTINUE_EXECUTION) {} #else + +#if defined(ANDROID) + pthread_setname_np(pthread_self(), threadName); +// #else +// pthread_setname_np(thread_name); +#endif + // Do nothing #endif // Set the locally known threadname using a thread local variable.