2011-05-03 20:13:51 -05:00
|
|
|
// xfail-stage1
|
|
|
|
// xfail-stage2
|
2011-07-20 21:37:09 -05:00
|
|
|
// xfail-stage3
|
2010-06-23 23:03:09 -05:00
|
|
|
// -*- rust -*-
|
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
fn f(c: chan[int]) {
|
|
|
|
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.
|
|
|
|
c <| 1;
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2010-08-16 17:04:33 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
while true {
|
|
|
|
// spin waiting for the parent to kill us.
|
|
|
|
log "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
|
|
|
|
c <| 1;
|
|
|
|
}
|
2010-06-23 23:03:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-19 15:35:49 -05:00
|
|
|
fn main() {
|
2011-07-27 07:19:39 -05:00
|
|
|
let p: port[int] = port();
|
|
|
|
spawn f(chan(p));
|
|
|
|
let i: int;
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
// synchronize on event from child.
|
|
|
|
p |> i;
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
log "parent exiting, killing child";
|
|
|
|
}
|