/src/test/run-pass/task-comm-15.rs
http://github.com/jruderman/rust · Rust · 21 lines · 14 code · 2 blank · 5 comment · 1 complexity · 711f7584f7f2c9668e0951419131301e MD5 · raw file
- // xfail-win32
- use std;
- import task;
- fn start(c: pipes::chan<int>, i0: int) {
- let mut i = i0;
- while i > 0 {
- c.send(0);
- i = i - 1;
- }
- }
- fn main() {
- // 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, p) = pipes::stream();
- task::spawn(|| start(ch, 10));
- p.recv();
- }