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

17 lines
205 B
Rust
Raw Normal View History

2010-06-23 23:03:09 -05:00
// -*- rust -*-
impure fn main() {
2010-06-23 23:03:09 -05:00
let port[int] p = port();
spawn child(chan(p));
let int y;
y <- p;
log "received";
log y;
check (y == 10);
}
impure fn child(chan[int] c) {
2010-06-23 23:03:09 -05:00
c <| 10;
}