source:
CIVL/examples/locks.cvl@
844ebd8
| Last change on this file since 844ebd8 was b6c1fcb, checked in by , 13 years ago | |
|---|---|
|
|
| File size: 349 bytes | |
| Rev | Line | |
|---|---|---|
| [b6c1fcb] | 1 | int x; |
| 2 | int y; | |
| 3 | ||
| 4 | void f(int n) { | |
| 5 | for (int i=0; i<n; i++) { | |
| 6 | \when (x==0) x=1; | |
| 7 | \when (y==0) y=1; | |
| 8 | y=0; | |
| 9 | x=0; | |
| 10 | } | |
| 11 | } | |
| 12 | ||
| 13 | void g(int m) { | |
| 14 | for (int i=0; i<m; i++) { | |
| 15 | \when (y==0) y=1; | |
| 16 | \when (x==0) x=1; | |
| 17 | x=0; | |
| 18 | y=0; | |
| 19 | } | |
| 20 | } | |
| 21 | ||
| 22 | void main() { | |
| 23 | x = 0; | |
| 24 | y = 0; | |
| 25 | \proc p = \spawn f(10); | |
| 26 | \proc q = \spawn g(10); | |
| 27 | \wait p; | |
| 28 | \wait q; | |
| 29 | } |
Note:
See TracBrowser
for help on using the repository browser.
