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

25 lines
300 B
Rust
Raw Normal View History

// xfail-stage0
2010-06-23 23:03:09 -05:00
// -*- rust -*-
2011-04-19 15:35:49 -05:00
fn main() {
2010-06-23 23:03:09 -05:00
let port[int] p = port();
auto c = chan(p);
let int y;
spawn child(c);
y <- p;
log "received 1";
log y;
check (y == 10);
2010-06-23 23:03:09 -05:00
spawn child(c);
y <- p;
log "received 2";
log y;
check (y == 10);
2010-06-23 23:03:09 -05:00
}
2011-04-19 15:35:49 -05:00
fn child(chan[int] c) {
2010-06-23 23:03:09 -05:00
c <| 10;
}