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

21 lines
342 B
Rust
Raw Normal View History

// xfail-win32
use std;
import std::task;
import std::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(c, f);
assert comm::recv(p);
}