RFR: 8254877: GCLogPrecious::_lock rank constrains what locks you are allowed to have when crashing [v2]

Stefan Karlsson stefank at openjdk.java.net
Thu Oct 29 09:38:59 UTC 2020


On Wed, 28 Oct 2020 16:02:37 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Stefan Karlsson has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review 1
>
> 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.

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

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


More information about the hotspot-dev mailing list