source: CIVL/examples/languageFeatures/atomicStatement.cvl@ 69193a9

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 69193a9 was 10e8759, checked in by Manchun Zheng <zmanchun@…>, 13 years ago

Implement $atomic and $atom blocks. Tests are added accordingly. TODO: implement related methods in TransientProcessState.java.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@372 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 217 bytes
RevLine 
[d410676]1int n = 3;
[9705dfd]2
3void main(){
[d410676]4 int x = 3;
[9705dfd]5
[10e8759]6 // non-determinism allowed in $atomic block
[9705dfd]7 $atomic{
[10e8759]8 $choose {
9 $when (n>2) { x=2; }
10 $when (n>1) { x=1; }
11 default: {x=0; }
[9705dfd]12 }
13 }
14
[10e8759]15 $assert (x == 2 || x == 1);
[9705dfd]16}
Note: See TracBrowser for help on using the repository browser.