summary refs log tree commit diff
path: root/src/test/run-pass/comm.rs
blob: 003b7c830934df4f920c26c1249cc97f808e5ab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- rust -*-

extern mod std;
use comm::Chan;
use comm::send;
use comm::recv;

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");
}