rust/src/test/run-pass/acyclic-unwind.rs
2011-08-31 14:24:08 +02:00

42 lines
858 B
Rust

// xfail-stage1
// xfail-stage2
// xfail-stage3
// -*- rust -*-
use std;
import std::comm;
import std::task;
fn f(c: comm::_chan<int>) {
type t = {_0: int, _1: int, _2: int};
// Allocate a box.
let x: @t = @{_0: 1, _1: 2, _2: 3};
// Signal parent that we've allocated a box.
comm::send(c, 1);
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
comm::send(c, 1);
}
}
fn main() {
let p = comm::mk_port();
task::_spawn(bind f(p.mk_chan()));
let i: int;
// synchronize on event from child.
i = p.recv();
log "parent exiting, killing child";
}