Mercurial > people > rkennke > hotspot-comp-zero > hotspot > .hg > patches
changeset 0:a9efa2633708
Initial Linnux implementation for set_native_thread_name().
author | Roman Kennke <rkennke@redhat.com> |
---|---|
date | Tue, 24 Jul 2012 10:09:03 +0200 |
parents | |
children | cef23de210a4 |
files | .hgignore linux_thread_name.patch series |
diffstat | 3 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Tue Jul 24 10:09:03 2012 +0200 @@ -0,0 +1,5 @@ +^\.hg +^\.mq +syntax: glob +status +guards
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linux_thread_name.patch Tue Jul 24 10:09:03 2012 +0200 @@ -0,0 +1,25 @@ +# HG changeset patch +# Parent dd785aabe02bf33c7a0aac1913d39f4960e7763b + +diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp +--- a/src/os/linux/vm/os_linux.cpp ++++ b/src/os/linux/vm/os_linux.cpp +@@ -4344,9 +4344,16 @@ + return online_cpus; + } + ++#define MAXTHREADNAMESIZE 16 ++ + void os::set_native_thread_name(const char *name) { +- // Not yet implemented. +- return; ++ if (name != NULL) { ++ // The maximum length is 16 (including the trailing \0), we copy ++ // the first 15 chars into the buffer. ++ char buf[MAXTHREADNAMESIZE]; ++ snprintf(buf, sizeof(buf), "%s", name); ++ pthread_setname_np(pthread_self(), buf); ++ } + } + + bool os::distribute_processes(uint length, uint* distribution) {