1
- // xfail-test
2
-
3
1
// A port of task-killjoin to use a class with a dtor to manage
4
2
// the join.
5
3
@@ -10,7 +8,7 @@ class notify {
10
8
let ch: comm:: chan<bool>; let v: @mut bool;
11
9
new ( ch: comm:: chan<bool>, v: @mut bool) { self . ch = ch; self . v = v; }
12
10
drop {
13
- #error~ [ "notify: task=%? v=%x unwinding=%b b=%b",
11
+ #error[ "notify: task=%? v=%x unwinding=%b b=%b",
14
12
task::get_task(),
15
13
ptr::addr_of(*(self.v)) as uint,
16
14
task::failing(),
@@ -20,11 +18,10 @@ class notify {
20
18
}
21
19
}
22
20
23
- fn joinable(f: fn~()) -> comm::port<bool> {
24
- fn wrapper(+pair: (comm::chan<bool>, fn())) {
25
- let (c, f) = pair;
21
+ fn joinable(+f: fn~()) -> comm::port<bool> {
22
+ fn wrapper(+c: comm::chan<bool>, +f: fn()) {
26
23
let b = @mut false;
27
- #error~ [" wrapper: task=%? allocated v=%x",
24
+ #error[" wrapper: task=%? allocated v=%x",
28
25
task:: get_task ( ) ,
29
26
ptr:: addr_of ( * b) as uint ] ;
30
27
let _r = notify ( c, b) ;
@@ -33,7 +30,7 @@ fn joinable(f: fn~()) -> comm::port<bool> {
33
30
}
34
31
let p = comm:: port ( ) ;
35
32
let c = comm:: chan ( p) ;
36
- let _ = task:: spawn_unlinked { || wrapper ( ( c, f ) ) } ;
33
+ do task:: spawn_unlinked { wrapper( c, copy f ) } ;
37
34
p
38
35
}
39
36
@@ -57,7 +54,7 @@ fn supervisor() {
57
54
}
58
55
59
56
fn main ( ) {
60
- join ( joinable ( { || supervisor ( ) } ) ) ;
57
+ join ( joinable ( supervisor) ) ;
61
58
}
62
59
63
60
// Local Variables:
0 commit comments