/src/test/run-pass/acyclic-unwind.rs
http://github.com/jruderman/rust · Rust · 39 lines · 19 code · 10 blank · 10 comment · 0 complexity · 93ffc1e3ddb6867014ce918c842c4ddc MD5 · raw file
- // xfail-test
- // -*- rust -*-
- use std;
- import comm;
- import task;
- fn f(c: comm::_chan<int>) {
- type t = {_0: int, _1: int, _2: int};
- // Allocate a box.
- let x: @t = @{_0: 1, _1: 2, _2: 3};
- // Signal parent that we've allocated a box.
- comm::send(c, 1);
- loop {
- // spin waiting for the parent to kill us.
- debug!{"child waiting to die..."};
- // while waiting to die, the messages we are
- // sending to the channel are never received
- // by the parent, therefore this test cases drops
- // messages on the floor
- comm::send(c, 1);
- }
- }
- fn main() {
- let p = comm::mk_port();
- task::_spawn(bind f(p.mk_chan()));
- let i: int;
- // synchronize on event from child.
- i = p.recv();
- debug!{"parent exiting, killing child"};
- }