From 753b497b4e7f5445bd5781572568b2b5cf0ce67d Mon Sep 17 00:00:00 2001 From: toddaaro <github@opprobrio.us> Date: Wed, 19 Jun 2013 15:23:14 -0700 Subject: [PATCH] Modified a match in resume_task_from_queue that was returning an int that was then matched on to instead use an enum. --- src/libstd/rt/sched.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index 5c082988012..453d3303db6 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -381,52 +381,44 @@ impl Scheduler { match home { &Some(Sched(ref home_handle)) if home_handle.sched_id != this.sched_id() => { - 0 + SendHome } &Some(AnySched) if this.run_anything => { - 1 + ResumeNow } &Some(AnySched) => { - 2 + Requeue } &Some(Sched(_)) => { - 3 + ResumeNow } &None => { - 4 + Homeless } } }; match action_id { - 0 => { + SendHome => { rtdebug!("sending task home"); Scheduler::send_task_home(task); Local::put(this); return false; } - 1 => { + ResumeNow => { rtdebug!("resuming now"); this.resume_task_immediately(task); return true; } - 2 => { + Requeue => { rtdebug!("re-queueing") this.enqueue_task(task); Local::put(this); return false; } - 3 => { - rtdebug!("resuming now"); - this.resume_task_immediately(task); - return true; - } - 4 => { + Homeless => { rtabort!("task home was None!"); } - _ => { - rtabort!("literally, you should not be here"); - } } } @@ -654,6 +646,14 @@ impl Scheduler { } } +// The cases for the below function. +enum ResumeAction { + SendHome, + Requeue, + ResumeNow, + Homeless +} + impl SchedHandle { pub fn send(&mut self, msg: SchedMessage) { self.queue.push(msg);