On Fri, 1 Dec 2023 11:14:04 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

>> test/lib/jdk/test/lib/process/OutputBuffer.java line 150:
>> 
>>> 148:     @Override
>>> 149:     public int getExitValue() {
>>> 150:       Integer exitCode = this.processExitCode;
>> 
>> Do we really need the local `exitCode` variable? Even if another multiple 
>> threads write to processExitCode, I expect them to all write a non-null 
>> Integer.
>
> Hello Stefan, this is just for a tiny optimization to prevent multiple reads 
> (in the same thread) on the `volatile` field `processExitCode` in this method.

I don't think such an optimization is needed here. This is not 
performance-critical code.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16919#discussion_r1412028528

Reply via email to