2011-03-25 14:19:20 -05:00
|
|
|
// xfail-stage0
|
2010-06-23 23:03:09 -05:00
|
|
|
// -*- rust -*-
|
|
|
|
|
2010-11-02 13:11:58 -05:00
|
|
|
impure fn f(chan[int] c)
|
2010-06-23 23:03:09 -05:00
|
|
|
{
|
|
|
|
type t = tup(int,int,int);
|
|
|
|
|
2010-07-01 00:45:54 -05:00
|
|
|
// Allocate a box.
|
2010-07-12 21:39:29 -05:00
|
|
|
let @t x = @tup(1,2,3);
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2010-07-01 00:45:54 -05:00
|
|
|
// Signal parent that we've allocated a box.
|
2010-06-23 23:03:09 -05:00
|
|
|
c <| 1;
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
// spin waiting for the parent to kill us.
|
|
|
|
log "child waiting to die...";
|
2010-08-16 17:04:33 -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
|
2010-06-23 23:03:09 -05:00
|
|
|
c <| 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-02 13:11:58 -05:00
|
|
|
impure fn main() {
|
2010-06-23 23:03:09 -05:00
|
|
|
let port[int] p = port();
|
|
|
|
spawn f(chan(p));
|
|
|
|
let int i;
|
|
|
|
|
|
|
|
// synchronize on event from child.
|
|
|
|
i <- p;
|
|
|
|
|
|
|
|
log "parent exiting, killing child";
|
|
|
|
}
|