rust/src/test/run-pass/task-comm-15.rs

24 lines
547 B
Rust
Raw Normal View History

// xfail-fast
// xfail-win32
#[legacy_modes];
extern mod std;
2012-08-28 13:11:15 -05:00
fn start(c: pipes::Chan<int>, i0: int) {
let mut i = i0;
2012-01-04 23:14:53 -06:00
while i > 0 {
2012-07-25 16:05:06 -05:00
c.send(0);
2012-01-04 23:14:53 -06:00
i = i - 1;
}
}
2011-04-19 15:35:49 -05:00
fn main() {
2010-09-07 20:01:35 -05:00
// 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!
2012-07-25 16:05:06 -05:00
let (ch, p) = pipes::stream();
task::spawn(|| start(ch, 10));
p.recv();
}