2011-08-31 06:22:58 -05:00
|
|
|
// xfail-test
|
2010-06-23 23:03:09 -05:00
|
|
|
// -*- rust -*-
|
|
|
|
|
2011-08-13 17:20:11 -05:00
|
|
|
use std;
|
|
|
|
|
2011-08-10 11:27:22 -05:00
|
|
|
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.
|
2011-08-13 17:20:11 -05:00
|
|
|
comm::send(c, 1);
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2010-08-16 17:04:33 -05:00
|
|
|
|
2012-03-09 18:11:56 -06: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
|
2011-08-13 17:20:11 -05:00
|
|
|
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() {
|
2011-08-13 17:20:11 -05:00
|
|
|
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.
|
2011-08-13 17:20:11 -05:00
|
|
|
i = p.recv();
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2012-08-22 19:24:52 -05:00
|
|
|
debug!("parent exiting, killing child");
|
2011-08-10 11:27:22 -05:00
|
|
|
}
|