RFR: 8343177: JFR: Remove critical section for thread id assignment [v2]

David Holmes dholmes at openjdk.org
Thu Oct 31 05:12:31 UTC 2024


On Thu, 31 Oct 2024 04:51:53 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> I changed this with the argument that it is unbalanced to have a non-static instance function available on all Threads for calling t->set_as_starting_thread(), which should only be called on a JavaThread, to set a static field, a static field that is only set once, by the main (primordial) JavaThread during startup in Threads::create_VM().
>> 
>> The assert function is_starting_thread(Thread*t) is for asserting the special assignment of 1 to the primordial thread.
>
> Okay so nothing inherently related to the critical section removal, just an API cleanup.

Actually the more I look at this the more I dislike the fact `set_as_starting_thread` also calls `os::create_main_thread`. Seems to me that should be done directly by the caller, and if successful we call `set_as_starting_thread`. But that is a different cleanup.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21756#discussion_r1823775332


More information about the hotspot-jfr-dev mailing list