This commit is contained in:
aozhiwei 2023-10-23 22:04:23 +08:00
parent 1449d29043
commit 873e104469

View File

@ -178,17 +178,23 @@ impl Timer {
while !cascade_list.borrow().empty() { while !cascade_list.borrow().empty() {
let timer = &cascade_list.borrow().first_entry().upgrade().unwrap(); let timer = &cascade_list.borrow().first_entry().upgrade().unwrap();
timer.borrow_mut().timer_entry.borrow_mut().del_init(); timer.borrow_mut().timer_entry.borrow_mut().del_init();
self.internal_add2(timer);
}
}
return index;
}
} fn get_timer_index(&self, index : usize) -> usize {
} return ((self.timer_tick as usize) >> (TVR_BITS + index * TVN_BITS)) &
return 0; TVN_MASK;
} }
pub fn update(&mut self) { pub fn update(&mut self) {
while (self.get_tick_count)() >= self.timer_tick { let tick = (self.get_tick_count)();
while tick >= self.timer_tick {
let index = (self.timer_tick & (TVR_MASK as i64)) as usize; let index = (self.timer_tick & (TVR_MASK as i64)) as usize;
if index == 0 { if index == 0 &&
self.cascade(&mut self.tv2, self.get_timer_index(0)) == 0 {
} }
self.timer_tick += 1; self.timer_tick += 1;
@ -336,7 +342,7 @@ impl Timer {
} }
pub fn get_idle_time(&self) -> i64 { pub fn get_idle_time(&self) -> i64 {
let mut idle_time = 0; let idle_time = 0;
return idle_time; return idle_time;
} }