File tree Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: ffd6ee0730f599de4765464f208d1c0cc3dcdfbc
2
+ refs/heads/master: 832d89db4791b4487f739ecd6e10140da147a537
Original file line number Diff line number Diff line change 1
- // xfail-stage1
2
- // xfail-stage2
3
- // xfail-stage3
4
-
5
1
// Create a task that is supervised by another task,
6
2
// join the supervised task from the supervising task,
7
3
// then fail the supervised task. The supervised task
8
4
// will kill the supervising task, waking it up. The
9
5
// supervising task no longer needs to be wakened when
10
6
// the supervised task exits.
11
7
8
+ use std;
9
+ import std:: task;
10
+
12
11
fn supervised ( ) {
13
12
// Yield to make sure the supervisor joins before we
14
13
// fail. This is currently not needed because the supervisor
15
14
// runs first, but I can imagine that changing.
16
- yield ;
15
+ task :: yield ( ) ;
17
16
fail;
18
17
}
19
18
20
19
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) ;
23
25
}
24
26
25
27
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) ;
31
30
}
32
31
33
32
// Local Variables:
You can’t perform that action at this time.
0 commit comments