blob: d9291fd68986518dd8322bc0bb51c714bc6ba6b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// xfail-win32
use std;
import comm;
import task;
fn start(c: comm::chan<int>, i0: int) {
let mut i = i0;
while i > 0 {
comm::send(c, 0);
i = i - 1;
}
}
fn main() {
let p = comm::port();
// Spawn a task that sends us back messages. The parent task
// is likely to terminate before the child completes, so from
// the child's point of view the receiver may die. We should
// drop messages on the floor in this case, and not crash!
let ch = comm::chan(p);
let child = task::spawn(|| start(ch, 10) );
let c = comm::recv(p);
}
|