fix the dumb
This commit is contained in:
parent
bb27f48f4a
commit
7a00dff4b9
|
@ -7,9 +7,6 @@ use {crate::host::TrapHandler, hbvm::vm::Vm};
|
||||||
|
|
||||||
pub struct Scheduler<'a> {
|
pub struct Scheduler<'a> {
|
||||||
data: VecDeque<Vm<'a, TrapHandler>>,
|
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
|
// NOTE: This is a very simple schduler and it sucks and should be replaced with a better one
|
||||||
|
@ -51,16 +48,5 @@ impl Scheduler<'_> {
|
||||||
let mut prog = self.data.pop_front().unwrap();
|
let mut prog = self.data.pop_front().unwrap();
|
||||||
prog.run().unwrap();
|
prog.run().unwrap();
|
||||||
self.data.push_back(prog);
|
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue