source:
CIVL/examples/concurrency/pointerShare2.cvl@
b863633
| Last change on this file since b863633 was 924c81b, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 244 bytes | |
| Rev | Line | |
|---|---|---|
| [2e23cba] | 1 | #include<civlc.h> |
| 2 | int *x; | |
| 3 | int *p; | |
| [924c81b] | 4 | $heap h = $heap_create(); |
| [2e23cba] | 5 | |
| 6 | void f() { | |
| 7 | int y=0; | |
| 8 | { | |
| 9 | int *q = p; | |
| 10 | y = y + 1; | |
| 11 | *q = 15; | |
| 12 | } | |
| 13 | } | |
| 14 | ||
| 15 | void main() { | |
| [924c81b] | 16 | x = (int*) $malloc(h, sizeof(int)); |
| [2e23cba] | 17 | p = x; |
| 18 | *x = 0; | |
| 19 | $spawn f(); | |
| 20 | $assert(*p==0); | |
| 21 | } |
Note:
See TracBrowser
for help on using the repository browser.
