| Index: base/threading/platform_thread_posix.cc
|
| diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
|
| index 872cb564c4d1784f6e05742bb5018ff133f63760..9b80af4a214fe8db079d452a951336435c885a8b 100644
|
| --- a/base/threading/platform_thread_posix.cc
|
| +++ b/base/threading/platform_thread_posix.cc
|
| @@ -166,11 +166,7 @@ void PlatformThread::Sleep(int duration_ms) {
|
| sleep_time = remaining;
|
| }
|
|
|
| -// Linux SetName is currently disabled, as we need to distinguish between
|
| -// helper threads (where it's ok to make this call) and the main thread
|
| -// (where making this call renames our process, causing tools like killall
|
| -// to stop working).
|
| -#if 0 && defined(OS_LINUX)
|
| +#if defined(OS_LINUX)
|
| // static
|
| void PlatformThread::SetName(const char* name) {
|
| // have to cast away const because ThreadLocalPointer does not support const
|
| @@ -178,6 +174,13 @@ void PlatformThread::SetName(const char* name) {
|
| current_thread_name.Pointer()->Set(const_cast<char*>(name));
|
| tracked_objects::ThreadData::InitializeThreadContext(name);
|
|
|
| + // On linux we can get the thread names to show up in the debugger by setting
|
| + // the process name for the LWP. We don't want to do this for the main
|
| + // thread because that would rename the process, causing tools like killall
|
| + // to stop working.
|
| + if (PlatformThread::CurrentId() == getpid())
|
| + return;
|
| +
|
| // http://0pointer.de/blog/projects/name-your-threads.html
|
|
|
| // glibc recently added support for pthread_setname_np, but it's not
|
|
|