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

22 lines
385 B
Rust
Raw Normal View History

// xfail-win32
use std;
import task;
import comm;
resource complainer(c: comm::chan<bool>) {
comm::send(c, true);
}
2011-10-20 22:34:04 -05:00
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::builder();
2012-02-18 18:34:42 -06:00
task::unsupervise(builder);
task::run(builder) {|| f(c); }
assert comm::recv(p);
}