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

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

updates CIVL to use the new ABC FrontEnd. tests updated accordingly when necessary.

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

  • Property mode set to 100644
File size: 587 bytes
Line 
1/* Commandline execution:
2 * civl verify atomicBlockResume.cvl
3 * */
4#include <civlc.cvh>
5
6int x = 1;
7int y = 0;
8int z = 0;
9int sum = 0;
10
11void foo(int i) {
12 $atomic {
13 y = y + i;
14 z++;
15 // blocked here until x is set to 0
16 $when(x==0)
17 switch(y) {
18 case 1: sum += 1*i; break;
19 case 2: sum += 2*i; break;
20 case 3: sum += 3*i; break;
21 };
22 }
23}
24
25void main(){
26 $proc fp1, fp2;
27
28 $atomic {
29 fp1 = $spawn foo(1);
30 fp2 = $spawn foo(2);
31 // blocked here until z++ has been executed twice
32 $when (z==2) x = 0;
33 }
34 $wait(fp1);
35 $wait(fp2);
36}
Note: See TracBrowser for help on using the repository browser.