aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/many.rs
blob: 3776d38e1124d9b1ad77adf84ac4c369750c57dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- rust -*-

io fn sub(chan[int] parent, int id) {
  if (id == 0) {
    parent <| 0;
  } else {
    let port[int] p = port();
    auto child = spawn sub(chan(p), id-1);
    let int y <- p;
    parent <| y + 1;
  }
}

io fn main() {
  let port[int] p = port();
  auto child = spawn sub(chan(p), 500);
  let int y <- p;
  check (y == 500);
}