Compare commits

...

2 Commits

Author SHA1 Message Date
MunirG05 88e324a8a9 fix the dumb 2023-07-11 13:32:40 +05:30
MunirG05 e3f6295997 fix the dumb 2023-07-11 13:30:45 +05:30
1 changed files with 1 additions and 16 deletions

View File

@ -7,9 +7,6 @@ use {crate::host::TrapHandler, hbvm::vm::Vm};
pub struct Scheduler<'a> {
data: VecDeque<Vm<'a, TrapHandler>>,
pub tick_callback: Option<fn() -> u64>,
pub last_timer_count: u64,
pub tick_limit: u64,
}
// NOTE: This is a very simple schduler and it sucks and should be replaced with a better one
@ -21,9 +18,7 @@ impl Scheduler<'_> {
pub fn new() -> Self {
Self {
data: VecDeque::new(),
tick_callback: None,
last_timer_count: 0,
tick_limit: 64,
}
}
pub fn new_process(&mut self, program: Vec<u8>) {
@ -51,16 +46,6 @@ impl Scheduler<'_> {
let mut prog = self.data.pop_front().unwrap();
prog.run().unwrap();
self.data.push_back(prog);
if self.tick_callback.is_some() {
let ret = self.tick_callback.unwrap()();
if (ret - self.last_timer_count) >= self.tick_limit {
return Some(0);
}
}
break;
}
Some(1)
}
}