Skip to content

Commit 832d89d

Browse files
committed
Bring run-pass/task-killjoin up to date and un-XFAIL
1 parent ffd6ee0 commit 832d89d

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/test/run-pass/task-killjoin.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
1-
// xfail-stage1
2-
// xfail-stage2
3-
// xfail-stage3
4-
51
// Create a task that is supervised by another task,
62
// join the supervised task from the supervising task,
73
// then fail the supervised task. The supervised task
84
// will kill the supervising task, waking it up. The
95
// supervising task no longer needs to be wakened when
106
// the supervised task exits.
117

8+
use std;
9+
import std::task;
10+
1211
fn supervised() {
1312
// Yield to make sure the supervisor joins before we
1413
// fail. This is currently not needed because the supervisor
1514
// runs first, but I can imagine that changing.
16-
yield;
15+
task::yield();
1716
fail;
1817
}
1918

2019
fn supervisor() {
21-
let task t = spawn "supervised" supervised();
22-
join t;
20+
// Unsupervise this task so the process doesn't return a failure status as
21+
// a result of the main task being killed.
22+
task::unsupervise();
23+
let t = spawn supervised();
24+
task::join(t);
2325
}
2426

2527
fn main() {
26-
// Start the test in another domain so that
27-
// the process doesn't return a failure status as a result
28-
// of the main task being killed.
29-
let task dom2 = spawn thread "supervisor" supervisor();
30-
join dom2;
28+
let dom2 = spawn supervisor();
29+
task::join(dom2);
3130
}
3231

3332
// Local Variables:

0 commit comments

Comments
 (0)