This commit is contained in:
aozhiwei 2023-10-09 21:17:49 +08:00
parent b3b93c650e
commit d1a75de683
2 changed files with 5 additions and 4 deletions

View File

@ -60,8 +60,8 @@ impl<T> ListHead<T> {
return self as *const ListHead<T> == self.next.upgrade().unwrap().as_ptr();
}
pub fn add_tail(head: &mut Rc::<RefCell::<ListHead<T>>>,
pnew: &mut Rc::<RefCell::<ListHead<T>>>) {
pub fn add_tail(head: &Rc::<RefCell::<ListHead<T>>>,
pnew: &Rc::<RefCell::<ListHead<T>>>) {
let prev = &mut head.borrow_mut().prev;
let next = Rc::downgrade(head);

View File

@ -13,7 +13,7 @@ const TVR_MASK: usize = TVR_SIZE - 1;
pub type TimerWp = Weak::<Rc::<RefCell::<TimerList>>>;
pub struct TimerAttacher {
timers: Rc::<RefCell::<crate::ListHead<TimerAttacher>>>,
timers: Rc::<RefCell::<crate::ListHead<TimerList>>>,
}
enum TimerType {
@ -132,7 +132,8 @@ impl Timer {
t.borrow_mut().expires = (self.get_tick_count)() + expire_time as i64;
match attacher {
Some(v) => {
crate::ListHead::add_tail(&v.borrow_mut().timers,
&t.borrow_mut().attach_entry);
}
None => {