source:
CIVL/mods/dev.civl.com/examples/por/fib.cvl@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 324 bytes | |
| Line | |
|---|---|
| 1 | #include<civlc.cvh> |
| 2 | #include<stdio.h> |
| 3 | |
| 4 | $input int N=3; |
| 5 | |
| 6 | int i=1,j=1; |
| 7 | void proc0(){ |
| 8 | for(int k=0; k<N; k++) |
| 9 | i+=j; |
| 10 | } |
| 11 | |
| 12 | void proc1(){ |
| 13 | for(int k=0; k<N; k++) |
| 14 | j+=i; |
| 15 | } |
| 16 | |
| 17 | int main(){ |
| 18 | $proc p0, p1; |
| 19 | |
| 20 | $atomic{ |
| 21 | p0=$spawn proc0(); |
| 22 | p1=$spawn proc1(); |
| 23 | } |
| 24 | $wait(p0); |
| 25 | $wait(p1); |
| 26 | printf("i=%d, j=%d\n", i, j); |
| 27 | } |
| 28 |
Note:
See TracBrowser
for help on using the repository browser.
