RFR: 7902989: jcstress: Add samples for high-level race conditions [v7]
    Aleksey Shipilev 
    shade at openjdk.java.net
       
    Fri Jul  2 14:22:20 UTC 2021
    
    
  
On Thu, 1 Jul 2021 16:01:36 GMT, Michael Mirwaldt <github.com+6693355+mmirwaldt at openjdk.org> wrote:
>> I have created two more samples:
>> 
>> - one sample for read-modify-write-sequences
>> - one sample for check-then-react-sequences
>
> Michael Mirwaldt has updated the pull request incrementally with one additional commit since the last revision:
> 
>   improved the code so that the used var names in the descriptions of the outcomes are not ambiguous any more now
This looks good, with two minor nits.
jcstress-samples/src/main/java/org/openjdk/jcstress/samples/high/race/condition/RaceCondition_01_ReadModifyWriteSequence.java line 55:
> 53:         v = v1;
> 54: 
> 55:         r.r1 = v1;
It is customary to call temporary variables `t`:
Suggestion:
        int t = v;
        t += 50;
        v = t;
        r.r1 = t;
jcstress-samples/src/main/java/org/openjdk/jcstress/samples/high/race/condition/RaceCondition_01_ReadModifyWriteSequence.java line 65:
> 63: 
> 64:         r.r2 = v2;
> 65:     }
Suggestion:
        int t = v;
        t -= 100;
        v = t;
        r.r2 = t;
    }
-------------
Marked as reviewed by shade (Committer).
PR: https://git.openjdk.java.net/jcstress/pull/88
    
    
More information about the jcstress-dev
mailing list