This commit is contained in:
aozhiwei 2023-10-08 20:59:26 +08:00
parent 60265ba68d
commit 0a99049c4b

View File

@ -22,7 +22,7 @@ struct TimerList {
holder: Rc::<RefCell::<TimerList>>,
wp: Rc::<Rc::<RefCell::<TimerList>>>,
timer_entry: Rc::<RefCell::<crate::ListHead<TimerList>>>,
attach_entry: Rc::<RefCell::<crate::ListHead<TimerAttacher>>>,
attach_entry: Rc::<RefCell::<crate::ListHead<TimerList>>>,
timer_type: i8,
expire_time: i32,
expires: i64,
@ -93,6 +93,12 @@ impl Timer {
expires: 0,
cb: None,
}));
p.borrow_mut().holder = p.clone();
p.borrow_mut().wp = Rc::new(p.borrow().holder.clone());
p.borrow_mut().timer_entry = crate::ListHead::<TimerList>::new_node(
Rc::downgrade(&p.borrow().holder)
);
p.borrow_mut().attach_entry = crate::ListHead::<TimerList>::new_head();
}
return p;
}