File tree 4 files changed +13
-25
lines changed
4 files changed +13
-25
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ use result::Result;
44
44
use result;
45
45
use rt:: { context, OldTaskContext , TaskContext } ;
46
46
use rt:: local:: Local ;
47
- use task:: rt:: task_id;
48
47
use unstable:: finally:: Finally ;
49
48
use util;
50
49
@@ -58,12 +57,6 @@ mod local_data_priv;
58
57
pub mod rt;
59
58
pub mod spawn;
60
59
61
- /// A handle to a task
62
- #[ deriving( Eq ) ]
63
- pub enum Task {
64
- TaskHandle ( task_id )
65
- }
66
-
67
60
/**
68
61
* Indicates the manner in which a task exited.
69
62
*
@@ -570,14 +563,6 @@ pub fn failing() -> bool {
570
563
}
571
564
}
572
565
573
- pub fn get_task ( ) -> Task {
574
- //! Get a handle to the running task
575
-
576
- unsafe {
577
- TaskHandle ( rt:: get_task_id ( ) )
578
- }
579
- }
580
-
581
566
/**
582
567
* Temporarily make the task unkillable
583
568
*
Original file line number Diff line number Diff line change 10
10
11
11
// Test that we use fully-qualified type names in error messages.
12
12
13
- use std:: task :: Task ;
13
+ use std:: option :: Option ;
14
14
15
- fn bar ( x : uint ) -> Task {
15
+ fn bar ( x : uint ) -> Option < uint > {
16
16
return x;
17
- //~^ ERROR mismatched types: expected `std::task::Task `
17
+ //~^ ERROR mismatched types: expected `std::option::Option<uint> `
18
18
}
19
19
20
20
fn main ( ) {
Original file line number Diff line number Diff line change 12
12
13
13
use std:: util;
14
14
15
+ pub type Task = int ;
16
+
15
17
// tjc: I don't know why
16
18
pub mod pipes {
19
+ use super :: Task ;
17
20
use std:: cast:: { forget, transmute} ;
18
21
use std:: cast;
19
22
use std:: task;
20
23
use std:: util;
21
24
22
25
pub struct Stuff < T > {
23
26
state : state ,
24
- blocked_task : Option < task :: Task > ,
27
+ blocked_task : Option < Task > ,
25
28
payload : Option < T >
26
29
}
27
30
@@ -35,15 +38,15 @@ pub mod pipes {
35
38
36
39
pub struct packet < T > {
37
40
state : state ,
38
- blocked_task : Option < task :: Task > ,
41
+ blocked_task : Option < Task > ,
39
42
payload : Option < T >
40
43
}
41
44
42
45
pub fn packet < T : Send > ( ) -> * packet < T > {
43
46
unsafe {
44
47
let p: * packet < T > = cast:: transmute ( ~Stuff {
45
48
state : empty,
46
- blocked_task : None :: < task :: Task > ,
49
+ blocked_task : None :: < Task > ,
47
50
payload : None :: < T >
48
51
} ) ;
49
52
p
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ impl Drop for notify {
27
27
fn drop ( & self ) {
28
28
unsafe {
29
29
error ! ( "notify: task=%? v=%x unwinding=%b b=%b" ,
30
- task :: get_task ( ) ,
30
+ 0 ,
31
31
ptr:: to_unsafe_ptr( & ( * ( self . v) ) ) as uint,
32
32
task:: failing( ) ,
33
33
* ( self . v) ) ;
@@ -48,7 +48,7 @@ fn joinable(f: ~fn()) -> Port<bool> {
48
48
fn wrapper ( c : Chan < bool > , f : & fn ( ) ) {
49
49
let b = @mut false ;
50
50
error ! ( "wrapper: task=%? allocated v=%x" ,
51
- task :: get_task ( ) ,
51
+ 0 ,
52
52
ptr:: to_unsafe_ptr( & ( * b) ) as uint) ;
53
53
let _r = notify ( c, b) ;
54
54
f ( ) ;
@@ -71,13 +71,13 @@ fn supervised() {
71
71
// Yield to make sure the supervisor joins before we
72
72
// fail. This is currently not needed because the supervisor
73
73
// runs first, but I can imagine that changing.
74
- error ! ( "supervised task=%?" , task :: get_task ) ;
74
+ error ! ( "supervised task=%?" , 0 ) ;
75
75
task:: yield ( ) ;
76
76
fail ! ( ) ;
77
77
}
78
78
79
79
fn supervisor ( ) {
80
- error ! ( "supervisor task=%?" , task :: get_task ( ) ) ;
80
+ error ! ( "supervisor task=%?" , 0 ) ;
81
81
let t = joinable ( supervised) ;
82
82
join ( t) ;
83
83
}
You can’t perform that action at this time.
0 commit comments