source: CIVL/examples/concurrency/locksBad10.cvl@ 4f22a92

1.23 2.0 main test-branch
Last change on this file since 4f22a92 was 20d2740, checked in by Stephen Siegel <siegel@…>, 13 years ago

Worked with Tim to get first message-passing example up. Cleaned up concurrency tests somewhat.

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

  • Property mode set to 100644
File size: 368 bytes
Line 
1#include<civlc.h>
2
3int x;
4int y;
5
6void f(int n) {
7 for (int i=0; i<n; i++) {
8 $when (x==0) x=1;
9 $when (y==0) y=1;
10 y=0;
11 x=0;
12 }
13}
14
15void g(int m) {
16 for (int i=0; i<m; i++) {
17 $when (y==0) y=1;
18 $when (x==0) x=1;
19 x=0;
20 y=0;
21 }
22}
23
24void main() {
25 x = 0;
26 y = 0;
27 $proc p = $spawn f(10);
28 $proc q = $spawn g(10);
29 $wait p;
30 $wait q;
31}
Note: See TracBrowser for help on using the repository browser.