source: CIVL/examples/contracts/update2.cvl@ bb03188

main test-branch
Last change on this file since bb03188 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: 827 bytes
Line 
1#include<collate.cvh>
2
3$gcollator gcollator=$gcollator_create($here, 2);
4_Bool start=$false;//, done=$false;
5int state[2]={[0]=0, [1]=0};
6
7void updating(int a, int b, int i){
8 int v=$pow(a,b);
9
10 state[i]=v;
11}
12
13
14void proc1(){
15 $collator collator=$collator_create(gcollator, $here, 0);
16
17 $collate_state cs=$collate_arrives(collator, $here);
18 start=$true;
19 $collate_departs(collator, cs);
20 $free(collator);
21}
22
23void proc2(){
24 $collator collator=$collator_create(gcollator, $here, 1);
25 $collate_state cs;
26
27 $when(start);
28 $update(collator) updating(5, 6, 1);
29 $update(collator) $pow(3, 4);
30 cs = $collate_arrives(collator, $here);
31 $collate_departs(collator, cs);
32 $free(collator);
33}
34
35int main(){
36 $proc p[2];
37
38 $atomic{
39 p[0]=$spawn proc1();
40 p[1]=$spawn proc2();
41 }
42 $waitall(p, 2);
43 $free(gcollator);
44}
Note: See TracBrowser for help on using the repository browser.