blob: d3b648e44757db6c8b311b628d6edaca76cdd7aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// -*- 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");
}
|