@@ -180,7 +180,7 @@ impl Scheduler {
180180
181181 // Take a main task to run, and a scheduler to run it in. Create a
182182 // scheduler task and bootstrap into it.
183- pub fn bootstrap ( mut ~ self ) {
183+ pub fn bootstrap ( mut self : Box < Scheduler > ) {
184184
185185 // Build an Idle callback.
186186 let cb = box SchedRunner as Box < Callback + Send > ;
@@ -224,7 +224,8 @@ impl Scheduler {
224224
225225 // This does not return a scheduler, as the scheduler is placed
226226 // inside the task.
227- pub fn run ( mut ~self , stask : Box < GreenTask > ) -> Box < GreenTask > {
227+ pub fn run ( mut self : Box < Scheduler > , stask : Box < GreenTask > )
228+ -> Box < GreenTask > {
228229
229230 // This is unsafe because we need to place the scheduler, with
230231 // the event_loop inside, inside our task. But we still need a
@@ -271,7 +272,7 @@ impl Scheduler {
271272 // If we try really hard to do some work, but no work is available to be
272273 // done, then we fall back to epoll() to block this thread waiting for more
273274 // work (instead of busy waiting).
274- fn run_sched_once ( mut ~ self , stask : Box < GreenTask > ) {
275+ fn run_sched_once ( mut self : Box < Scheduler > , stask : Box < GreenTask > ) {
275276 // Make sure that we're not lying in that the `stask` argument is indeed
276277 // the scheduler task for this scheduler.
277278 assert ! ( self . sched_task. is_none( ) ) ;
@@ -349,11 +350,10 @@ impl Scheduler {
349350 // returns the still-available scheduler. At this point all
350351 // message-handling will count as a turn of work, and as a result
351352 // return None.
352- fn interpret_message_queue ( mut ~self , stask : Box < GreenTask > ,
353+ fn interpret_message_queue ( mut self : Box < Scheduler > ,
354+ stask : Box < GreenTask > ,
353355 effort : EffortLevel )
354- -> ( Box < Scheduler > , Box < GreenTask > , bool )
355- {
356-
356+ -> ( Box < Scheduler > , Box < GreenTask > , bool ) {
357357 let msg = if effort == DontTryTooHard {
358358 self . message_queue . casual_pop ( )
359359 } else {
@@ -432,7 +432,7 @@ impl Scheduler {
432432 }
433433 }
434434
435- fn do_work ( mut ~ self , stask : Box < GreenTask > )
435+ fn do_work ( mut self : Box < Scheduler > , stask : Box < GreenTask > )
436436 -> ( Box < Scheduler > , Box < GreenTask > , bool ) {
437437 rtdebug ! ( "scheduler calling do work" ) ;
438438 match self . find_work ( ) {
@@ -517,7 +517,7 @@ impl Scheduler {
517517 // * Task Routing Functions - Make sure tasks send up in the right
518518 // place.
519519
520- fn process_task ( mut ~ self ,
520+ fn process_task ( mut self : Box < Scheduler > ,
521521 cur : Box < GreenTask > ,
522522 mut next : Box < GreenTask > ,
523523 schedule_fn : SchedulingFn )
@@ -610,7 +610,7 @@ impl Scheduler {
610610 // cleanup function f, which takes the scheduler and the
611611 // old task as inputs.
612612
613- pub fn change_task_context ( mut ~ self ,
613+ pub fn change_task_context ( mut self : Box < Scheduler > ,
614614 mut current_task : Box < GreenTask > ,
615615 mut next_task : Box < GreenTask > ,
616616 f : |& mut Scheduler , Box < GreenTask > |)
@@ -693,7 +693,7 @@ impl Scheduler {
693693
694694 // * Context Swapping Helpers - Here be ugliness!
695695
696- pub fn resume_task_immediately ( ~ self ,
696+ pub fn resume_task_immediately ( self : Box < Scheduler > ,
697697 cur : Box < GreenTask > ,
698698 next : Box < GreenTask > )
699699 -> ( Box < Scheduler > , Box < GreenTask > ) {
@@ -733,7 +733,7 @@ impl Scheduler {
733733 /// This situation is currently prevented, or in other words it is
734734 /// guaranteed that this function will not return before the given closure
735735 /// has returned.
736- pub fn deschedule_running_task_and_then ( mut ~ self ,
736+ pub fn deschedule_running_task_and_then ( mut self : Box < Scheduler > ,
737737 cur : Box < GreenTask > ,
738738 f : |& mut Scheduler , BlockedTask |) {
739739 // Trickier - we need to get the scheduler task out of self
@@ -743,7 +743,7 @@ impl Scheduler {
743743 self . switch_running_tasks_and_then ( cur, stask, f)
744744 }
745745
746- pub fn switch_running_tasks_and_then ( ~ self ,
746+ pub fn switch_running_tasks_and_then ( self : Box < Scheduler > ,
747747 cur : Box < GreenTask > ,
748748 next : Box < GreenTask > ,
749749 f : |& mut Scheduler , BlockedTask |) {
@@ -795,7 +795,9 @@ impl Scheduler {
795795
796796 /// Called by a running task to end execution, after which it will
797797 /// be recycled by the scheduler for reuse in a new task.
798- pub fn terminate_current_task ( mut ~self , cur : Box < GreenTask > ) -> ! {
798+ pub fn terminate_current_task ( mut self : Box < Scheduler > ,
799+ cur : Box < GreenTask > )
800+ -> ! {
799801 // Similar to deschedule running task and then, but cannot go through
800802 // the task-blocking path. The task is already dying.
801803 let stask = self . sched_task . take_unwrap ( ) ;
@@ -807,7 +809,9 @@ impl Scheduler {
807809 fail ! ( "should never return!" ) ;
808810 }
809811
810- pub fn run_task ( ~self , cur : Box < GreenTask > , next : Box < GreenTask > ) {
812+ pub fn run_task ( self : Box < Scheduler > ,
813+ cur : Box < GreenTask > ,
814+ next : Box < GreenTask > ) {
811815 let ( sched, task) =
812816 self . process_task ( cur, next, Scheduler :: switch_task) ;
813817 task. put_with_sched ( sched) ;
@@ -823,7 +827,7 @@ impl Scheduler {
823827 /// to introduce some amount of randomness to the scheduler. Currently the
824828 /// randomness is a result of performing a round of work stealing (which
825829 /// may end up stealing from the current scheduler).
826- pub fn yield_now ( mut ~ self , cur : Box < GreenTask > ) {
830+ pub fn yield_now ( mut self : Box < Scheduler > , cur : Box < GreenTask > ) {
827831 // Async handles trigger the scheduler by calling yield_now on the local
828832 // task, which eventually gets us to here. See comments in SchedRunner
829833 // for more info on this.
@@ -842,7 +846,7 @@ impl Scheduler {
842846 }
843847 }
844848
845- pub fn maybe_yield ( mut ~ self , cur : Box < GreenTask > ) {
849+ pub fn maybe_yield ( mut self : Box < Scheduler > , cur : Box < GreenTask > ) {
846850 // It's possible for sched tasks to possibly call this function, and it
847851 // just means that they're likely sending on channels (which
848852 // occasionally call this function). Sched tasks follow different paths
0 commit comments