RFR: JDK-8152690: main thread does not have native thread name

Robbin Ehn robbin.ehn at oracle.com
Thu Mar 24 16:51:11 UTC 2016


Hi Yasumasa,

I'm not sure why you don't set it:

diff -r ded6ef79c770 src/share/vm/runtime/thread.cpp
--- a/src/share/vm/runtime/thread.cpp	Thu Mar 24 13:09:16 2016 +0000
+++ b/src/share/vm/runtime/thread.cpp	Thu Mar 24 17:40:09 2016 +0100
@@ -3584,6 +3584,7 @@
   JavaThread* main_thread = new JavaThread();
   main_thread->set_thread_state(_thread_in_vm);
   main_thread->initialize_thread_current();
+  main_thread->set_native_thread_name("main");
   // must do this before set_active_handles
   main_thread->record_stack_base_and_size();
   main_thread->set_active_handles(JNIHandleBlock::allocate_block());

here instead? Am I missing something?

The launcher seem to name itself 'java' and naming this thread just
'main' is confusing to me.

E.g. so main thread of the process (and thus the process) is 'java' but
first JavaThread is 'main'.

Thanks!

/Robbin

On 03/24/2016 03:26 PM, Yasumasa Suenaga wrote:
> Hi all,
> 
> HotSpot for Linux will set thread name via pthread_setname_np().
> However, main thread does not have it.
> 
> All JavaThread have native name, and main thread is JavaThread.
> For consistency, main thread should have native thread name.
> 
> I uploaded a webrev. Could you review it?
> 
>    http://cr.openjdk.java.net/~ysuenaga/JDK-8152690/webrev.00/
> 
> I cannot access JPRT.
> So I need a sponsor.
> 
> 
> Thanks,
> 
> Yasumasa
> 


More information about the hotspot-runtime-dev mailing list