RFR: 8322853: Should use ConditionalMutexLocker in NativeHeapTrimmerThread::print_state

Quan Anh Mai qamai at openjdk.org
Wed Jan 3 05:43:46 UTC 2024


On Tue, 2 Jan 2024 16:04:30 GMT, Denghui Dong <ddong at openjdk.org> wrote:

> Hi all,
> 
> Please help review this small fix.
> 
> MutexLocker requires that mutex != nullptr, so we should use ConditionalMutexLocker instead.
> 
> Also, this patch made '_stop' volatile, since it will be read twice in run() but may be changed.

Anyway please do not use `volatile` for synchronisation purposes, if you are unsure then a relaxed atomic load is the way to go.

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

PR Comment: https://git.openjdk.org/jdk/pull/17226#issuecomment-1874874706


More information about the hotspot-runtime-dev mailing list