rust/src/test/run-pass/many.rs

25 lines
430 B
Rust
Raw Normal View History

2011-07-27 07:48:34 -05:00
// xfail-stage1
// xfail-stage2
// xfail-stage3
// -*- 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 |> y;
parent <| y + 1;
}
}
fn main() {
let port[int] p = port();
auto child = spawn sub(chan(p), 500);
let int p |> y;
log "transmission complete";
log y;
assert (y == 500);
}