2011-08-31 07:24:08 -05:00
|
|
|
// xfail-stage1
|
|
|
|
// xfail-stage2
|
|
|
|
// xfail-stage3
|
2010-06-23 23:03:09 -05:00
|
|
|
// -*- rust -*-
|
|
|
|
|
2011-08-13 17:20:11 -05:00
|
|
|
use std;
|
|
|
|
import std::comm;
|
|
|
|
import std::task;
|
|
|
|
|
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
|
|
|
|
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
|
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
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
log "parent exiting, killing child";
|
2011-08-10 11:27:22 -05:00
|
|
|
}
|