RFR: 8297173: usageTicks and totalTicks should be volatile to ensure that different threads get the latest ticks [v2]
Poison
duke at openjdk.org
Thu Nov 17 09:43:39 UTC 2022
On Thu, 17 Nov 2022 09:35:07 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Poison has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8297173: usageTicks and totalTicks should be volatile
>
> src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java line 53:
>
>> 51: private abstract class ContainerCpuTicks {
>> 52: private volatile long usageTicks = 0;
>> 53: private volatile long totalTicks = 0;
>
> You can drop initialising the fields to 0 (their default value) while you are at it as they are volatile writes.
OK
-------------
PR: https://git.openjdk.org/jdk/pull/11199
More information about the serviceability-dev
mailing list