RFR: 8320318: ObjectMonitor Responsible thread [v3]

Axel Boldt-Christmas aboldtch at openjdk.org
Wed Sep 18 21:03:40 UTC 2024


On Wed, 18 Sep 2024 20:54:01 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

>> Fredrik Bredberg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update two, after the review
>
> src/hotspot/share/runtime/objectMonitor.cpp line 385:
> 
>> 383: }
>> 384: 
>> 385: bool ObjectMonitor::try_enter(JavaThread* current, bool check_owner) {
> 
> The `check_owner` name is a little confusing to me. To me it looks more like `check_for_recursion` or `handle_recursion`.

I think the name should describe what setting the value actually does, but if it is just a hack to do what the comment bellow says, then it sounds like a friend declaration for `SharedRuntime::monitor_exit_helper()` is what is wanted. (Or make TryLock() public.)
> Set check_owner to false (it's default value is true) if you want
> to use ObjectMonitor::try_enter() as a public way of doing TryLock().
> Used this way in SharedRuntime::monitor_exit_helper().

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19454#discussion_r1765717750


More information about the hotspot-dev mailing list