rust/src/test/run-pass/comm.rs
2012-01-06 22:40:31 -08:00

25 lines
400 B
Rust

// -*- rust -*-
use std;
import comm;
import comm::chan;
import comm::send;
import comm::recv;
import task;
fn main() {
let p = comm::port();
let ch = comm::chan(p);
let t = task::spawn {|| child(ch); };
let y = recv(p);
#error("received");
log(error, y);
assert (y == 10);
}
fn child(c: chan<int>) {
#error("sending");
send(c, 10);
#error("value sent");
}