rust/src/test/run-pass/acyclic-unwind.rs

38 lines
797 B
Rust
Raw Normal View History

// xfail-test
2010-06-23 23:03:09 -05:00
// -*- rust -*-
extern mod std;
fn f(c: comm::_chan<int>) {
2011-07-27 07:19:39 -05:00
type t = {_0: int, _1: int, _2: int};
2010-06-23 23:03:09 -05:00
2011-07-27 07:19:39 -05:00
// Allocate a box.
let x: @t = @{_0: 1, _1: 2, _2: 3};
2010-06-23 23:03:09 -05:00
2011-07-27 07:19:39 -05:00
// Signal parent that we've allocated a box.
comm::send(c, 1);
2010-06-23 23:03:09 -05:00
2010-08-16 17:04:33 -05:00
loop {
2011-07-27 07:19:39 -05:00
// spin waiting for the parent to kill us.
2012-08-22 19:24:52 -05:00
debug!("child waiting to die...");
2011-07-27 07:19:39 -05:00
// 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);
2011-07-27 07:19:39 -05:00
}
2010-06-23 23:03:09 -05:00
}
2011-04-19 15:35:49 -05:00
fn main() {
let p = comm::mk_port();
task::_spawn(bind f(p.mk_chan()));
2011-07-27 07:19:39 -05:00
let i: int;
2010-06-23 23:03:09 -05:00
2011-07-27 07:19:39 -05:00
// synchronize on event from child.
i = p.recv();
2010-06-23 23:03:09 -05:00
2012-08-22 19:24:52 -05:00
debug!("parent exiting, killing child");
}