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

19 lines
272 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();
let task t = spawn child(chan(p));
2010-06-23 23:03:09 -05:00
let int y;
p |> y;
log_err "received";
log_err y;
assert (y == 10);
2010-06-23 23:03:09 -05:00
}
2011-04-19 15:35:49 -05:00
fn child(chan[int] c) {
log_err "sending";
2010-06-23 23:03:09 -05:00
c <| 10;
log_err "value sent"
2010-06-23 23:03:09 -05:00
}