RFR: 7902982: jcstress: Add samples for some mutex algorithms [v10]
    Aleksey Shipilev 
    shade at openjdk.java.net
       
    Tue Jun 29 16:03:18 UTC 2021
    
    
  
On Tue, 29 Jun 2021 15:50:13 GMT, mmirwaldt for openjdk <github.com+86246875+mmirwaldt-openjdk at openjdk.org> wrote:
>> jcstress-samples/src/main/java/org/openjdk/jcstress/samples/concurreny/mutex/Mutex_03_AtomicBoolean.java line 53:
>> 
>>> 51:     @Actor
>>> 52:     public void actor1(II_Result r) {
>>> 53:         while(taken.get() || !taken.compareAndSet(false, true)); // spin
>> 
>> Suggestion:
>> 
>>         while(!taken.compareAndSet(false, true)) {
>>             // wait for entering into the critical section
>>         }
>> 
>> 
>> I think `taken.get()` is not needed here, and adding explicit braces makes it easier to understand that the braces for "critical section" are different ones.
>
> Well, @shipilev proposed it. I cannot find his comment.
This is TTAS, it is OK in this form.
-------------
PR: https://git.openjdk.java.net/jcstress/pull/85
    
    
More information about the jcstress-dev
mailing list