This commit is contained in:
aozhiwei 2023-10-12 08:57:54 +08:00
parent 98a3cd3fe7
commit 30c02c0c0c

View File

@ -14,6 +14,7 @@ pub type TimerWp = Weak::<Rc::<RefCell::<TimerList>>>;
pub type TimerCb = Box::<dyn FnMut (i32, Option<Vec<Rc::<dyn Any>>>)>; pub type TimerCb = Box::<dyn FnMut (i32, Option<Vec<Rc::<dyn Any>>>)>;
type TimerListListHeadRp = Rc::<RefCell::<crate::ListHead<TimerList>>>; type TimerListListHeadRp = Rc::<RefCell::<crate::ListHead<TimerList>>>;
type TimerListRp = Rc::<RefCell::<TimerList>>; type TimerListRp = Rc::<RefCell::<TimerList>>;
type TimerListWp = Weak::<RefCell::<TimerList>>;
pub struct TimerAttacher { pub struct TimerAttacher {
timers: TimerListListHeadRp, timers: TimerListListHeadRp,
@ -48,17 +49,17 @@ pub struct TimerList {
pub struct Timer { pub struct Timer {
free_timer_num: i32, free_timer_num: i32,
free_timer_list: Rc::<RefCell::<crate::ListHead<TimerList>>>, free_timer_list: TimerListListHeadRp,
running_timer: Weak::<RefCell::<TimerList>>, running_timer: TimerListWp,
timer_tick: i64, timer_tick: i64,
get_tick_count: fn () -> i64, get_tick_count: fn () -> i64,
cache_timer_num: i32, cache_timer_num: i32,
work_list: Rc::<RefCell::<crate::ListHead<TimerList>>>, work_list: TimerListListHeadRp,
tv1: [Rc::<RefCell::<crate::ListHead<TimerList>>>; TVR_SIZE], tv1: [TimerListListHeadRp; TVR_SIZE],
tv2: [Rc::<RefCell::<crate::ListHead<TimerList>>>; TVN_SIZE], tv2: [TimerListListHeadRp; TVN_SIZE],
tv3: [Rc::<RefCell::<crate::ListHead<TimerList>>>; TVN_SIZE], tv3: [TimerListListHeadRp; TVN_SIZE],
tv4: [Rc::<RefCell::<crate::ListHead<TimerList>>>; TVN_SIZE], tv4: [TimerListListHeadRp; TVN_SIZE],
tv5: [Rc::<RefCell::<crate::ListHead<TimerList>>>; TVN_SIZE], tv5: [TimerListListHeadRp; TVN_SIZE],
} }
impl Timer { impl Timer {