Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions awkernel_async_lib/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ impl SchedulerType {
/// - The lowest priority.
/// - Panicked scheduler.
static PRIORITY_LIST: [SchedulerType; 4] = [
SchedulerType::Panicked,
SchedulerType::PrioritizedRR(0),
SchedulerType::PrioritizedFIFO(0),
SchedulerType::GEDF(0),
SchedulerType::PrioritizedFIFO(0),
SchedulerType::PrioritizedRR(0),
SchedulerType::Panicked,
];

pub(crate) trait Scheduler {
Expand Down Expand Up @@ -156,12 +156,12 @@ pub(crate) fn get_scheduler(sched_type: SchedulerType) -> &'static dyn Scheduler
}

pub const fn get_priority(sched_type: SchedulerType) -> u8 {
let mut priority = 0;
while priority < PRIORITY_LIST.len() {
if PRIORITY_LIST[priority].equals(&sched_type) {
return priority as u8;
let mut index = 0;
while index < PRIORITY_LIST.len() {
if PRIORITY_LIST[index].equals(&sched_type) {
return (PRIORITY_LIST.len() - 1 - index) as u8;
}
priority += 1;
index += 1;
}
panic!("Scheduler type not registered in PRIORITY_LIST or equals()")
}
Expand Down