Skip to content

Commit

Permalink
Fix and un-xfail task-killjoin-rsrc.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
bblum committed Jul 23, 2012
1 parent d0fb853 commit 81f1081
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/test/run-pass/task-killjoin-rsrc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// xfail-test

// A port of task-killjoin to use a class with a dtor to manage
// the join.

Expand All @@ -10,7 +8,7 @@ class notify {
let ch: comm::chan<bool>; let v: @mut bool;
new(ch: comm::chan<bool>, v: @mut bool) { self.ch = ch; self.v = v; }
drop {
#error~["notify: task=%? v=%x unwinding=%b b=%b",
#error["notify: task=%? v=%x unwinding=%b b=%b",
task::get_task(),
ptr::addr_of(*(self.v)) as uint,
task::failing(),
Expand All @@ -20,11 +18,10 @@ class notify {
}
}
fn joinable(f: fn~()) -> comm::port<bool> {
fn wrapper(+pair: (comm::chan<bool>, fn())) {
let (c, f) = pair;
fn joinable(+f: fn~()) -> comm::port<bool> {
fn wrapper(+c: comm::chan<bool>, +f: fn()) {
let b = @mut false;
#error~["wrapper: task=%? allocated v=%x",
#error["wrapper: task=%? allocated v=%x",
task::get_task(),
ptr::addr_of(*b) as uint];
let _r = notify(c, b);
Expand All @@ -33,7 +30,7 @@ fn joinable(f: fn~()) -> comm::port<bool> {
}
let p = comm::port();
let c = comm::chan(p);
let _ = task::spawn_unlinked {|| wrapper((c, f)) };
do task::spawn_unlinked { wrapper(c, copy f) };
p
}

Expand All @@ -57,7 +54,7 @@ fn supervisor() {
}

fn main() {
join(joinable({|| supervisor()}));
join(joinable(supervisor));
}

// Local Variables:
Expand Down

0 comments on commit 81f1081

Please sign in to comment.