source:
CIVL/examples/por/wait.cvl
| Last change on this file was ea777aa, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 387 bytes | |
| Rev | Line | |
|---|---|---|
| [e6b02c8] | 1 | #include<civlc.cvh> |
| [0c69eda] | 2 | |
| 3 | int x = 0, u = 0; | |
| 4 | $proc hp; | |
| 5 | ||
| 6 | void f(){ | |
| 7 | int v = 0; | |
| 8 | ||
| 9 | $choose{ | |
| 10 | $when($true) v = 0; | |
| 11 | $when(x) v = 1; | |
| 12 | } | |
| [3ff27cf] | 13 | $assert((v == 0)); |
| [0c69eda] | 14 | } |
| 15 | ||
| 16 | void g(){ | |
| 17 | $wait(hp); | |
| 18 | x = 1; | |
| 19 | } | |
| 20 | ||
| 21 | void h(){ | |
| 22 | u = 1; | |
| 23 | } | |
| 24 | ||
| 25 | void main(){ | |
| 26 | $proc procs[3]; | |
| 27 | ||
| 28 | $atomic{ | |
| 29 | procs[0] = $spawn f(); | |
| 30 | procs[2] = $spawn h(); | |
| 31 | hp = procs[2]; | |
| 32 | procs[1] = $spawn g(); | |
| 33 | } | |
| 34 | $waitall(procs, 3); | |
| 35 | } |
Note:
See TracBrowser
for help on using the repository browser.
