source:
CIVL/examples/languageFeatures/atomicFunctionSpecifier.cvl@
44512b7
| Last change on this file since 44512b7 was a8a3f22, checked in by , 10 years ago | |
|---|---|
|
|
| File size: 184 bytes | |
| Rev | Line | |
|---|---|---|
| [a8a3f22] | 1 | #include<civlc.cvh> |
| 2 | ||
| 3 | $atomic_f void increase(int* p){ | |
| 4 | int old=*p; | |
| 5 | ||
| 6 | *p=(*p)+1; | |
| 7 | ||
| 8 | $assert(old+1==*p); | |
| 9 | } | |
| 10 | ||
| 11 | int data=0; | |
| 12 | ||
| 13 | void main(){ | |
| 14 | $parfor(int i: 0 .. 1) | |
| 15 | increase(&data); | |
| 16 | } |
Note:
See TracBrowser
for help on using the repository browser.
