Changes between Version 8 and Version 9 of Language
- Timestamp:
- 05/18/23 10:43:55 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Language
v8 v9 377 377 There is no guarantee that execution of `stmt` will continue atomically if it contains more than one atomic action, i.e., other processes may be scheduled. 378 378 379 Examples: 379 ==== Example 380 380 381 381 {{{ … … 385 385 The execution of `s--` is guaranteed to take place in an environment in which `s` is positive. 386 386 387 ==== Example 388 387 389 {{{ 388 390 $when (s>0) { s--; t++; } … … 393 395 $when (s>0) s--; t++; 394 396 }}} 395 To make the entire statement atomic, one must use an `$atomic` statement. 396 397 {{{ 398 $when (s>0) $when (t>0) x=y*t; 399 }}} 400 This blocks until both `x` and `t` are positive then executes the assignment in that state. 401 It is equivalent to 402 {{{ 403 $when (s>0 && t>0) x=y*t; 404 }}} 397 To make the entire statement atomic, one must use an `$atomic` statement; see the following example. 398 399 ==== Example 405 400 406 401 The following statements are all equivalent: … … 412 407 Each of these waits until `s` is positive, then from such a state, decrements `s` and increments `t` without the intervention of other processes. 413 408 409 ==== Example 410 411 {{{ 412 $when (s>0) $when (t>0) x=y*t; 413 }}} 414 This blocks until both `x` and `t` are positive then executes the assignment in that state. 415 It is equivalent to 416 {{{ 417 $when (s>0 && t>0) x=y*t; 418 }}} 419 420 414 421 == Functions 415 422
