rust/src/test/run-pass/unwind-resource.rs
2012-02-20 18:58:04 -08:00

22 lines
393 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>) {
let c <- complainer(c);
fail;
}
fn main() {
let p = comm::port();
let c = comm::chan(p);
let builder = task::mk_task_builder();
task::unsupervise(builder);
task::run(builder) {|| f(c); }
assert comm::recv(p);
}