@@ -22,7 +22,7 @@ export set_min_stack;
22
22
export task_result;
23
23
export tr_success;
24
24
export tr_failure;
25
- export get_task_id ;
25
+ export get_task ;
26
26
export spawn;
27
27
export spawn_notify;
28
28
export spawn_joinable;
@@ -31,7 +31,7 @@ native "cdecl" mod rustrt {
31
31
// these must run on the Rust stack so that they can swap stacks etc:
32
32
fn task_sleep ( time_in_us : uint ) ;
33
33
fn task_yield ( ) ;
34
- fn start_task ( id : task_id , closure : * u8 ) ;
34
+ fn start_task ( id : task , closure : * u8 ) ;
35
35
}
36
36
37
37
native "c-stack-cdecl" mod rustrt2 = "rustrt" {
@@ -43,7 +43,7 @@ native "c-stack-cdecl" mod rustrt2 = "rustrt" {
43
43
fn set_min_stack ( stack_size : uint ) ;
44
44
45
45
fn new_task ( ) -> task_id ;
46
- fn drop_task ( task : * rust_task ) ;
46
+ fn drop_task ( task_id : * rust_task ) ;
47
47
fn get_task_pointer ( id : task_id ) -> * rust_task ;
48
48
49
49
fn migrate_alloc ( alloc : * u8 , target : task_id ) ;
@@ -57,11 +57,11 @@ type rust_task =
57
57
58
58
resource rust_task_ptr ( task: * rust_task) { rustrt2:: drop_task ( task) ; }
59
59
60
- type task = int ;
61
- type task_id = task ;
62
- type joinable_task = ( task_id , comm:: port < task_notification > ) ;
60
+ type task_id = int ;
61
+ type task = task_id ;
62
+ type joinable_task = ( task , comm:: port < task_notification > ) ;
63
63
64
- fn get_task_id ( ) -> task_id { rustrt2:: get_task_id ( ) }
64
+ fn get_task ( ) -> task { rustrt2:: get_task_id ( ) }
65
65
66
66
/**
67
67
* Hints the scheduler to yield this task for a specified ammount of time.
@@ -76,7 +76,7 @@ tag task_result { tr_success; tr_failure; }
76
76
77
77
tag task_notification { exit( task, task_result) ; }
78
78
79
- fn join ( task_port : ( task_id , comm :: port < task_notification > ) ) -> task_result {
79
+ fn join ( task_port : joinable_task ) -> task_result {
80
80
let ( id, port) = task_port;
81
81
alt comm:: recv :: < task_notification > ( port) {
82
82
exit ( _id, res) {
@@ -96,12 +96,12 @@ fn unpin() { rustrt2::unpin_task(); }
96
96
fn set_min_stack ( stack_size : uint ) { rustrt2:: set_min_stack ( stack_size) ; }
97
97
98
98
fn spawn < unique T > ( -data : T , f : fn ( T ) ) -> task {
99
- spawn_inner2 ( data, f, none)
99
+ spawn_inner ( data, f, none)
100
100
}
101
101
102
102
fn spawn_notify < unique T > ( -data : T , f : fn ( T ) ,
103
103
notify : comm:: chan < task_notification > ) -> task {
104
- spawn_inner2 ( data, f, some ( notify) )
104
+ spawn_inner ( data, f, some ( notify) )
105
105
}
106
106
107
107
fn spawn_joinable < unique T > ( -data : T , f : fn ( T ) ) -> joinable_task {
@@ -120,9 +120,9 @@ fn spawn_joinable<unique T>(-data: T, f: fn(T)) -> joinable_task {
120
120
//
121
121
// After the transition this should all be rewritten.
122
122
123
- fn spawn_inner2 < unique T > ( -data : T , f : fn ( T ) ,
123
+ fn spawn_inner < unique T > ( -data : T , f : fn ( T ) ,
124
124
notify : option < comm:: chan < task_notification > > )
125
- -> task_id {
125
+ -> task {
126
126
127
127
fn wrapper < unique T > ( -data : * u8 , f : fn ( T ) ) {
128
128
let data: ~T = unsafe :: reinterpret_cast ( data) ;
@@ -140,7 +140,7 @@ fn spawn_inner2<unique T>(-data: T, f: fn(T),
140
140
// It is a hack and needs to be rewritten.
141
141
fn unsafe_spawn_inner( -thunk : fn @( ) ,
142
142
notify : option < comm:: chan < task_notification > > ) ->
143
- task_id unsafe {
143
+ task unsafe {
144
144
let id = rustrt2:: new_task ( ) ;
145
145
146
146
let raw_thunk: { code : u32 , env : u32 } = cast ( thunk) ;
0 commit comments