#include<collate.cvh>

$input int N=2;

$gcollator gcollator=$gcollator_create($here, N);

void process(int id){
  $scope here = $here;	
  $collator collator=$collator_create(gcollator, here, id);
  $collate_state cs=$collate_arrives(collator, here);

  $with (cs) {
    $assert($true);
  }
  $collate_departs(collator, cs);
  $free(collator);
}


int main(){
  $parfor(int i: 0 .. N-1)
    process(i);
  $free(gcollator);
}
