Modified a match in resume_task_from_queue that was returning an int that was then matched on to instead use an enum.

This commit is contained in:
toddaaro 2013-06-19 15:23:14 -07:00
parent 29ad8e15a2
commit 753b497b4e

View File

@ -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);