--- old/src/os/linux/vm/os_linux.cpp 2012-07-24 21:37:16.510842463 +0200 +++ new/src/os/linux/vm/os_linux.cpp 2012-07-24 21:37:16.430967917 +0200 @@ -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) {