RFR: 8254877: GCLogPrecious::_lock rank constrains what locks you are allowed to have when crashing [v2]
Albert Mingkun Yang
ayang at openjdk.java.net
Thu Oct 29 09:42:50 UTC 2020
On Thu, 29 Oct 2020 09:34:12 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
>> src/hotspot/share/gc/shared/gcLogPrecious.cpp line 30:
>>
>>> 28: stringStream* GCLogPrecious::_lines = NULL;
>>> 29: stringStream* GCLogPrecious::_temp = NULL;
>>> 30: Semaphore* GCLogPrecious::_lock = NULL;
>>
>> Maybe renaming `_lock` to `_semaphore`? Additionally, since it's a binary semaphore, `new Semaphore(1)`, some comments explaining why `Mutex` is **not** suitable could avoid some future confusions.
>>
>> PS: not a review, just a comment in passing.
>
> It's used as a lock, so I think the name `_lock` is appropriate. Instead I introduced a new class: `SemaphoreLock`, to make the code more readable (IMHO). Also added a comment. Hopefully, this addressed your comments.
Thank you; it does look more readable. BTW, mutex has `try_lock` as well.
-------------
PR: https://git.openjdk.java.net/jdk/pull/903
More information about the hotspot-dev
mailing list