Commit f6fa051e authored by rbyers@chromium.org's avatar rbyers@chromium.org

Enable setting thread names on Linux

BUG=107547
TEST=Manual

Review URL: http://codereview.chromium.org/8936015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114681 0039d316-1c4b-4281-b951-d872f2087c98
parent d030986a
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment