@@ -181,8 +181,10 @@ pub impl Scheduler {
181
181
// XXX: Reenable this once we're using a per-task queue. With a shared
182
182
// queue this is not true
183
183
//assert!(sched.work_queue.is_empty());
184
- // let out = sched.metrics.to_str();
185
- // rtdebug!("scheduler metrics: %s\n", out);
184
+ rtdebug ! ( "scheduler metrics: %s\n " , {
185
+ use to_str:: ToStr ;
186
+ sched. metrics. to_str( )
187
+ } ) ;
186
188
return sched;
187
189
}
188
190
@@ -728,19 +730,19 @@ pub impl Coroutine {
728
730
// using the AnySched paramter.
729
731
730
732
fn new_homed ( stack_pool : & mut StackPool , home : SchedHome , start : ~fn ( ) ) -> Coroutine {
731
- Coroutine :: with_task_homed ( stack_pool, ~Task :: new ( ) , start, home)
733
+ Coroutine :: with_task_homed ( stack_pool, ~Task :: new_root ( ) , start, home)
732
734
}
733
735
734
- fn new ( stack_pool : & mut StackPool , start : ~fn ( ) ) -> Coroutine {
735
- Coroutine :: with_task ( stack_pool, ~Task :: new ( ) , start)
736
+ fn new_root ( stack_pool : & mut StackPool , start : ~fn ( ) ) -> Coroutine {
737
+ Coroutine :: with_task ( stack_pool, ~Task :: new_root ( ) , start)
736
738
}
737
739
738
740
fn with_task_homed ( stack_pool : & mut StackPool ,
739
741
task : ~Task ,
740
742
start : ~fn ( ) ,
741
743
home : SchedHome ) -> Coroutine {
742
744
743
- static MIN_STACK_SIZE : uint = 10000000 ; // XXX: Too much stack
745
+ static MIN_STACK_SIZE : uint = 1000000 ; // XXX: Too much stack
744
746
745
747
let start = Coroutine :: build_start_wrapper ( start) ;
746
748
let mut stack = stack_pool. take_segment ( MIN_STACK_SIZE ) ;
@@ -930,14 +932,14 @@ mod test {
930
932
} ;
931
933
let t1f = Cell ( t1f) ;
932
934
933
- let t2f = ~do Coroutine :: new ( & mut normal_sched. stack_pool ) {
935
+ let t2f = ~do Coroutine :: new_root ( & mut normal_sched. stack_pool ) {
934
936
let on_special = Coroutine :: on_special ( ) ;
935
937
rtdebug ! ( "t2 should not be on special: %b" , on_special) ;
936
938
assert ! ( !on_special) ;
937
939
} ;
938
940
let t2f = Cell ( t2f) ;
939
941
940
- let t3f = ~do Coroutine :: new ( & mut normal_sched. stack_pool ) {
942
+ let t3f = ~do Coroutine :: new_root ( & mut normal_sched. stack_pool ) {
941
943
// not on special
942
944
let on_special = Coroutine :: on_special ( ) ;
943
945
rtdebug ! ( "t3 should not be on special: %b" , on_special) ;
@@ -986,7 +988,7 @@ mod test {
986
988
let t4 = Cell ( t4) ;
987
989
988
990
// build a main task that runs our four tests
989
- let main_task = ~do Coroutine :: new ( & mut normal_sched. stack_pool ) {
991
+ let main_task = ~do Coroutine :: new_root ( & mut normal_sched. stack_pool ) {
990
992
// the two tasks that require a normal start location
991
993
t2. take ( ) ( ) ;
992
994
t4. take ( ) ( ) ;
@@ -1141,7 +1143,7 @@ mod test {
1141
1143
let task_ran_ptr: * mut bool = & mut task_ran;
1142
1144
1143
1145
let mut sched = ~new_test_uv_sched ( ) ;
1144
- let task = ~do Coroutine :: new ( & mut sched. stack_pool ) {
1146
+ let task = ~do Coroutine :: new_root ( & mut sched. stack_pool ) {
1145
1147
unsafe { * task_ran_ptr = true ; }
1146
1148
} ;
1147
1149
sched. enqueue_task ( task) ;
@@ -1159,7 +1161,7 @@ mod test {
1159
1161
1160
1162
let mut sched = ~new_test_uv_sched ( ) ;
1161
1163
for int:: range( 0 , total) |_| {
1162
- let task = ~do Coroutine :: new ( & mut sched. stack_pool ) {
1164
+ let task = ~do Coroutine :: new_root ( & mut sched. stack_pool ) {
1163
1165
unsafe { * task_count_ptr = * task_count_ptr + 1 ; }
1164
1166
} ;
1165
1167
sched. enqueue_task ( task) ;
@@ -1176,10 +1178,10 @@ mod test {
1176
1178
let count_ptr: * mut int = & mut count;
1177
1179
1178
1180
let mut sched = ~new_test_uv_sched ( ) ;
1179
- let task1 = ~do Coroutine :: new ( & mut sched. stack_pool ) {
1181
+ let task1 = ~do Coroutine :: new_root ( & mut sched. stack_pool ) {
1180
1182
unsafe { * count_ptr = * count_ptr + 1 ; }
1181
1183
let mut sched = Local :: take :: < Scheduler > ( ) ;
1182
- let task2 = ~do Coroutine :: new ( & mut sched. stack_pool ) {
1184
+ let task2 = ~do Coroutine :: new_root ( & mut sched. stack_pool ) {
1183
1185
unsafe { * count_ptr = * count_ptr + 1 ; }
1184
1186
} ;
1185
1187
// Context switch directly to the new task
@@ -1204,7 +1206,7 @@ mod test {
1204
1206
1205
1207
let mut sched = ~new_test_uv_sched ( ) ;
1206
1208
1207
- let start_task = ~do Coroutine :: new ( & mut sched. stack_pool ) {
1209
+ let start_task = ~do Coroutine :: new_root ( & mut sched. stack_pool ) {
1208
1210
run_task ( count_ptr) ;
1209
1211
} ;
1210
1212
sched. enqueue_task ( start_task) ;
@@ -1214,7 +1216,7 @@ mod test {
1214
1216
1215
1217
fn run_task ( count_ptr : * mut int ) {
1216
1218
do Local :: borrow :: < Scheduler , ( ) > |sched| {
1217
- let task = ~do Coroutine :: new ( & mut sched. stack_pool ) {
1219
+ let task = ~do Coroutine :: new_root ( & mut sched. stack_pool ) {
1218
1220
unsafe {
1219
1221
* count_ptr = * count_ptr + 1 ;
1220
1222
if * count_ptr != MAX {
@@ -1232,7 +1234,7 @@ mod test {
1232
1234
fn test_block_task ( ) {
1233
1235
do run_in_bare_thread {
1234
1236
let mut sched = ~new_test_uv_sched( ) ;
1235
- let task = ~do Coroutine :: new ( & mut sched. stack_pool ) {
1237
+ let task = ~do Coroutine :: new_root ( & mut sched. stack_pool ) {
1236
1238
let sched = Local :: take :: < Scheduler > ( ) ;
1237
1239
assert ! ( sched. in_task_context( ) ) ;
1238
1240
do sched. deschedule_running_task_and_then ( ) |sched, task| {
@@ -1279,13 +1281,13 @@ mod test {
1279
1281
let mut sched1 = ~new_test_uv_sched ( ) ;
1280
1282
let handle1 = sched1. make_handle ( ) ;
1281
1283
let handle1_cell = Cell ( handle1) ;
1282
- let task1 = ~do Coroutine :: new ( & mut sched1. stack_pool ) {
1284
+ let task1 = ~do Coroutine :: new_root ( & mut sched1. stack_pool ) {
1283
1285
chan_cell. take ( ) . send ( ( ) ) ;
1284
1286
} ;
1285
1287
sched1. enqueue_task ( task1) ;
1286
1288
1287
1289
let mut sched2 = ~new_test_uv_sched ( ) ;
1288
- let task2 = ~do Coroutine :: new ( & mut sched2. stack_pool ) {
1290
+ let task2 = ~do Coroutine :: new_root ( & mut sched2. stack_pool ) {
1289
1291
port_cell. take ( ) . recv ( ) ;
1290
1292
// Release the other scheduler's handle so it can exit
1291
1293
handle1_cell. take ( ) ;
0 commit comments