main
test-branch
| Line | |
|---|
| 1 | #include<civlc.cvh>
|
|---|
| 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 | }
|
|---|
| 13 | $assert((v == 0));
|
|---|
| 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.