RFR: 8241403: JavaThread::get_thread_name() should be ThreadSMR-aware [v3]

Daniel D.Daugherty dcubed at openjdk.java.net
Wed Feb 17 17:44:49 UTC 2021


On Wed, 17 Feb 2021 06:56:26 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Daniel D. Daugherty has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - Merge branch 'master' into JDK-8241403
>>  - Address coleenp CR0 comments.
>>  - 8241403: JavaThread::get_thread_name() should be ThreadSMR-aware
>
> src/hotspot/share/runtime/thread.cpp line 486:
> 
>> 484: 
>> 485: // Is the target JavaThread protected by this Thread:
>> 486: bool Thread::is_JavaThread_protected(const JavaThread* p) {
> 
> Why is this a function on Thread instead of JavaThread??

I made it a function on Thread because a Thread can use a ThreadsListHandle
to protect access to JavaThreads and we're checking the ThreadsList(s) that
are associated with the calling Thread.

It dawns on me that the comment could have been more clear:

`// Is the target JavaThread protected by the calling Thread:`

If I had written the comment that way, then I would have realized that the
function should be static in Thread and then it could call Thread::current()
itself and then make its checks of the ThreadsList(s).

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

PR: https://git.openjdk.java.net/jdk/pull/2535


More information about the serviceability-dev mailing list