blob: 0baa0aca7ade032182fa1ac1bec9707648359a85 (
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
25
26
27
28
29
30
31
32
|
/*
This is a test case for Issue 507.
https://github.com/graydon/rust/issues/507
*/
extern mod std;
use comm::Chan;
use comm::send;
use comm::Port;
use comm::recv;
fn grandchild(c: Chan<int>) { send(c, 42); }
fn child(c: Chan<int>) {
task::spawn(|| grandchild(c) )
}
fn main() {
let p = comm::Port();
let ch = Chan(&p);
task::spawn(|| child(ch) );
let x: int = recv(p);
log(debug, x);
assert (x == 42);
}
|