main
test-branch
|
Last change
on this file since a389857 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
439 bytes
|
| Line | |
|---|
| 1 | #include<civlc.cvh>
|
|---|
| 2 | #include<stdio.h>
|
|---|
| 3 |
|
|---|
| 4 | int result[2];
|
|---|
| 5 |
|
|---|
| 6 | $atomic_f int oneOrTwo(){
|
|---|
| 7 | int res;
|
|---|
| 8 |
|
|---|
| 9 | $choose{
|
|---|
| 10 | res=1;
|
|---|
| 11 | res=2;
|
|---|
| 12 | }
|
|---|
| 13 | return res;
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | $atomic_f void increase(int i, int* p){
|
|---|
| 17 | int old=*p;
|
|---|
| 18 | int step=oneOrTwo();
|
|---|
| 19 |
|
|---|
| 20 | *p=(*p)+step;
|
|---|
| 21 | $assert(old+step==*p);
|
|---|
| 22 | result[i]=*p;
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | int data=0;
|
|---|
| 26 |
|
|---|
| 27 | void main(){
|
|---|
| 28 | $parfor(int i: 0 .. 1)
|
|---|
| 29 | increase(i, &data);
|
|---|
| 30 | $for(int i: 0 .. 1)
|
|---|
| 31 | printf("process %d: result=%d\n", i, result[i]);
|
|---|
| 32 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.