summaryrefslogtreecommitdiff
path: root/Test/og/parallel4.bpl
blob: 22e7173f157fa9acb62abf489bc125eff7632ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var a:int;

procedure Allocate() returns ({:linear "tid"} xls: int);

procedure {:entrypoint} {:yields} main() 
{
  var {:linear "tid"} i: int;
  var {:linear "tid"} j: int;
  call i := Allocate();
  call j := Allocate();
  par i := t(i) | j := t(j);
}

procedure {:yields} {:stable} t({:linear "tid"} i': int) returns ({:linear "tid"} i: int)
{
  i := i';
  call Yield();
  assert a == old(a);
  a := a + 1;
}

procedure {:yields} Yield()
{
  yield;
}