This commit is contained in:
aozhiwei 2023-10-29 14:09:47 +08:00
parent 28d9f032e2
commit a7e0c032f6

View File

@ -2,6 +2,8 @@ use std::rc::{Rc, Weak};
use std::cell::RefCell;
use std::any::Any;
use std::cmp;
use std::time::{Duration, Instant};
use r9_macro::SharedFromSelf;
use r9_macro_derive::SharedFromSelf;
@ -307,9 +309,7 @@ impl XTimer {
expire_time: i32,
cb: TimerCb,
attacher: Option<XTimerAttacherRp>) -> XTimerWp {
println!("2222");
let t = self.new_timer_list();
println!("111111");
t.borrow_mut().cb = Some(cb);
t.borrow_mut().timer_type = timer_type;
t.borrow_mut().expire_time = expire_time;
@ -358,7 +358,6 @@ impl XTimer {
index = (t.borrow().expires >> (TVR_BITS + 3 * TVN_BITS)) & (TVN_MASK as i64);
vec = &self.tv5[index as usize];
}
println!("add2 idx:{} index:{}", idx, index);
crate::ListHead::<TimerList>::add_tail(&vec, &t.borrow_mut().timer_entry);
}
@ -514,7 +513,8 @@ impl XTimer {
}
fn gc_timer(&mut self, e: TimerEvent, _args: Option<Vec<Rc::<dyn Any>>>) {
println!("aaaaa");
let now = Instant::now();
println!("now: {:?}", now);
match e {
TimerEvent::Exec => {
while self.free_timer_num > self.cache_timer_num &&