source: CIVL/examples/languageFeatures/atomicBlockedResume.cvl@ 4f22a92

1.23 2.0 main test-branch
Last change on this file since 4f22a92 was 2c448829, checked in by Manchun Zheng <zmanchun@…>, 12 years ago

Improve the implementation for $atomic and $atom statements, taking into account non-determinism, blocking, loop, etc in $atomic blocks.

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

  • Property mode set to 100644
File size: 387 bytes
Line 
1#include <civlc.h>
2
3int x = 1;
4int y = 0;
5int z = 0;
6int sum = 0;
7
8void foo(int i){
9 $atomic{
10 y = y + i;
11 z++;
12 $when(x==0)
13 switch(y){
14 case 1: sum += 1*i; break;
15 case 2: sum += 2*i; break;
16 case 3: sum += 3*i; break;
17 };
18 }
19}
20
21void main(){
22 $spawn foo(1);
23 $spawn foo(2);
24 $when (z==2) x = 0;
25}
Note: See TracBrowser for help on using the repository browser.