1
This commit is contained in:
parent
b3b93c650e
commit
d1a75de683
@ -60,8 +60,8 @@ impl<T> ListHead<T> {
|
|||||||
return self as *const ListHead<T> == self.next.upgrade().unwrap().as_ptr();
|
return self as *const ListHead<T> == self.next.upgrade().unwrap().as_ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_tail(head: &mut Rc::<RefCell::<ListHead<T>>>,
|
pub fn add_tail(head: &Rc::<RefCell::<ListHead<T>>>,
|
||||||
pnew: &mut Rc::<RefCell::<ListHead<T>>>) {
|
pnew: &Rc::<RefCell::<ListHead<T>>>) {
|
||||||
let prev = &mut head.borrow_mut().prev;
|
let prev = &mut head.borrow_mut().prev;
|
||||||
let next = Rc::downgrade(head);
|
let next = Rc::downgrade(head);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ const TVR_MASK: usize = TVR_SIZE - 1;
|
|||||||
pub type TimerWp = Weak::<Rc::<RefCell::<TimerList>>>;
|
pub type TimerWp = Weak::<Rc::<RefCell::<TimerList>>>;
|
||||||
|
|
||||||
pub struct TimerAttacher {
|
pub struct TimerAttacher {
|
||||||
timers: Rc::<RefCell::<crate::ListHead<TimerAttacher>>>,
|
timers: Rc::<RefCell::<crate::ListHead<TimerList>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TimerType {
|
enum TimerType {
|
||||||
@ -132,7 +132,8 @@ impl Timer {
|
|||||||
t.borrow_mut().expires = (self.get_tick_count)() + expire_time as i64;
|
t.borrow_mut().expires = (self.get_tick_count)() + expire_time as i64;
|
||||||
match attacher {
|
match attacher {
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
|
crate::ListHead::add_tail(&v.borrow_mut().timers,
|
||||||
|
&t.borrow_mut().attach_entry);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user