rust/src/test/run-pass/unwind-resource.rs
2012-01-06 22:40:31 -08:00

21 lines
337 B
Rust

// xfail-win32
use std;
import task;
import comm;
resource complainer(c: comm::chan<bool>) {
comm::send(c, true);
}
fn f(c: comm::chan<bool>) {
task::unsupervise();
let c <- complainer(c);
fail;
}
fn main() {
let p = comm::port();
let c = comm::chan(p);
task::spawn {|| f(c); };
assert comm::recv(p);
}