1
This commit is contained in:
parent
aff0907a6b
commit
1709853ee5
18
src/timer.rs
18
src/timer.rs
@ -83,7 +83,7 @@ impl Timer {
|
||||
}
|
||||
self.timer_tick = (self.get_tick_count)();
|
||||
let cb = Rc::new(
|
||||
|e: i32, args: Option<Vec<Rc::<dyn Any>>>| {
|
||||
|_event: i32, _args: Option<Vec<Rc::<dyn Any>>>| {
|
||||
//self.gc_timer(e, args);
|
||||
}
|
||||
);
|
||||
@ -98,7 +98,7 @@ impl Timer {
|
||||
|
||||
}
|
||||
|
||||
fn clear(&mut self, cb: Option<Rc::<dyn Fn (i32, Option<Vec<Rc::<dyn Any>>>)>>) {
|
||||
fn clear(&mut self) {
|
||||
|
||||
}
|
||||
|
||||
@ -155,6 +155,20 @@ impl Timer {
|
||||
}
|
||||
{
|
||||
let idx = t.borrow().expires - self.timer_tick;
|
||||
let mut index = 0;
|
||||
let vec: &mut Rc::<RefCell::<crate::ListHead<TimerList>>>;
|
||||
if idx < 0 {
|
||||
index = self.timer_tick & (TVR_MASK as i64);
|
||||
vec = &mut self.tv1[index as usize];
|
||||
} else if idx < TVR_SIZE as i64 {
|
||||
index = t.borrow().expires & (TVR_MASK as i64);
|
||||
vec = &mut self.tv1[index as usize];
|
||||
} else {
|
||||
index = t.borrow().expires & (TVR_MASK as i64);
|
||||
vec = &mut self.tv1[index as usize];
|
||||
}
|
||||
crate::ListHead::add_tail(&vec,
|
||||
&t.borrow_mut().timer_entry);
|
||||
}
|
||||
return Rc::downgrade(&t.borrow().wp);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user