On Sat, 2 Jul 2022 02:32:09 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:

>> Chris Plummer has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   provide a slightly more descriptive @summary
>
> test/jdk/com/sun/jdi/SuspendAfterDeath.java line 73:
> 
>> 71: 
>> 72: public class SuspendAfterDeath extends TestScaffold {
>> 73:     private volatile ThreadReference thread;
> 
> One minor naming suggestion:
> The name `thread` is too generic. What about something like `targetThread` or 
> `testedThread`?

Ok. I'll rename to targetThread.

> test/jdk/com/sun/jdi/TestScaffold.java line 976:
> 
>> 974:                 }
>> 975:             });
>> 976:             Thread.currentThread().setName(OLD_MAIN_THREAD_NAME);
> 
> Just want to understand what is this thread naming is about.
> Is it just to properly name the threads, or there is some other reason for 
> this?
> Also, why OLD_MAIN_THREAD_NAME is a little bit strange and why old?

The "main" debuggee thread is always launched as a platform thread. There's no 
choice in that since it is simply the main application thread. When using the 
virtual thread wrapper, the "main" thread will spawn a virtual thread to run 
the debuggee on. By default virtual threads have no name. For the nsk debugger 
tests, "main" was renamed to "old-m-a-i-n", and the new debuggee virtual thread 
named "main". For some reason that was never done for the com/sun/jdi tests. I 
only made this change because in `breakpointReached()` of the test it prints 
out the thread, and I noticed the name was empty.  I could leave this change 
out if you want and file a separate CR for it. The test should still run ok 
without it.

-------------

PR: https://git.openjdk.org/jdk19/pull/88

Reply via email to