blob: 5b67fdc64e07207c7c0b73a1be7cf3bcf0754228 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// xfail-boot
// xfail-stage0
// -*- rust -*-
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;
}
}
fn main() {
let port[int] p = port();
auto child = spawn sub(chan(p), 500);
let int y <- p;
log "transmission complete";
log y;
assert (y == 500);
}
|