Changes between Version 7 and Version 8 of Language


Ignore:
Timestamp:
05/18/23 08:50:52 (3 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Language

    v7 v8  
    389389}}}
    390390The execution of `s--` must happen when `s>0`, but between `s--` and `t++`, other processes may execute.
     391The curly braces in the code above do not accomplish anything---the code is equivalent to
     392{{{
     393$when (s>0) s--; t++;
     394}}}
     395To make the entire statement atomic, one must use an `$atomic` statement.
    391396
    392397{{{
     
    399404}}}
    400405
    401 
    402406The following statements are all equivalent:
    403407{{{
    404408$when (s>0) $atomic{ s--; t++; }
    405409$atomic{ $when(s>0); s--; t++; }
    406 $atomic{ $when(s>0) {s--; t++; } }
     410$atomic{ $when(s>0) { s--; t++; } }
    407411}}}
    408412Each of these waits until `s` is positive, then from such a state, decrements `s` and increments `t` without the intervention of other processes.