rust/src/test/run-pass/acyclic-unwind.rs

31 lines
473 B
Rust
Raw Normal View History

2010-06-23 23:03:09 -05:00
// -*- rust -*-
io fn f(chan[int] c)
{
type t = tup(int,int,int);
// Allocate an exterior.
let @t x = tup(1,2,3);
// Signal parent that we've allocated an exterior.
c <| 1;
while (true) {
// spin waiting for the parent to kill us.
log "child waiting to die...";
c <| 1;
}
}
io fn main() {
let port[int] p = port();
spawn f(chan(p));
let int i;
// synchronize on event from child.
i <- p;
log "parent exiting, killing child";
}