source:
CIVL/examples/por/heap1.cvl
| Last change on this file was ea777aa, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 422 bytes | |
| Rev | Line | |
|---|---|---|
| [e6b02c8] | 1 | #include <civlc.cvh> |
| [a0852d1] | 2 | |
| 3 | int *p; | |
| 4 | _Bool start = $false; | |
| [d66b03b] | 5 | $scope root = $here; |
| [a0852d1] | 6 | void f(){ |
| 7 | $when(start); | |
| [d66b03b] | 8 | p = (int*) $malloc(root, sizeof(int)); |
| [a0852d1] | 9 | h = &fh; |
| 10 | //$free(&fh, p); | |
| 11 | } | |
| 12 | ||
| 13 | void g(){ | |
| 14 | $heap gh; | |
| 15 | ||
| 16 | $when(start); | |
| 17 | h = &gh; | |
| 18 | //p = (int*) $malloc(h, sizeof(int)); | |
| 19 | //$free(&gh, p); | |
| 20 | } | |
| 21 | ||
| 22 | void main(){ | |
| 23 | $proc ps[2]; | |
| 24 | ||
| 25 | ps[0] = $spawn f(); | |
| 26 | ps[1] = $spawn g(); | |
| 27 | start = $true; | |
| 28 | $wait ps[0]; | |
| 29 | $wait ps[1]; | |
| 30 | $free(h, p); | |
| 31 | } |
Note:
See TracBrowser
for help on using the repository browser.
