source:
CIVL/mods/dev.civl.com/examples/por/loop.cvl@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 389 bytes | |
| Line | |
|---|---|
| 1 | #include<civlc.cvh> |
| 2 | |
| 3 | int g=0; |
| 4 | |
| 5 | void proc0(){ |
| 6 | int x,y,z; |
| 7 | |
| 8 | $atomic{ |
| 9 | while(1){ |
| 10 | x=0; |
| 11 | y=0; |
| 12 | z=0; |
| 13 | } |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | void proc1(){ |
| 18 | g=1; |
| 19 | $assert(g==1); |
| 20 | } |
| 21 | |
| 22 | void proc2(){ |
| 23 | g=2; |
| 24 | $assert(g==2); |
| 25 | } |
| 26 | |
| 27 | int main(){ |
| 28 | $proc p0, p1, p2; |
| 29 | |
| 30 | $atomic{ |
| 31 | p0=$spawn proc0(); |
| 32 | p1=$spawn proc1(); |
| 33 | p2=$spawn proc2(); |
| 34 | } |
| 35 | $wait(p1); |
| 36 | $wait(p2); |
| 37 | $assert(g==0); |
| 38 | $wait(p0); |
| 39 | } |
Note:
See TracBrowser
for help on using the repository browser.
