Changes between Version 7 and Version 8 of Language
- Timestamp:
- 05/18/23 08:50:52 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Language
v7 v8 389 389 }}} 390 390 The execution of `s--` must happen when `s>0`, but between `s--` and `t++`, other processes may execute. 391 The curly braces in the code above do not accomplish anything---the code is equivalent to 392 {{{ 393 $when (s>0) s--; t++; 394 }}} 395 To make the entire statement atomic, one must use an `$atomic` statement. 391 396 392 397 {{{ … … 399 404 }}} 400 405 401 402 406 The following statements are all equivalent: 403 407 {{{ 404 408 $when (s>0) $atomic{ s--; t++; } 405 409 $atomic{ $when(s>0); s--; t++; } 406 $atomic{ $when(s>0) { s--; t++; } }410 $atomic{ $when(s>0) { s--; t++; } } 407 411 }}} 408 412 Each of these waits until `s` is positive, then from such a state, decrements `s` and increments `t` without the intervention of other processes.
