This commit is contained in:
aozhiwei 2023-10-07 22:30:34 +08:00
parent b246bd745a
commit f87e9107f5

View File

@ -1,5 +1,6 @@
use std::rc::{Rc, Weak};
use std::cell::RefCell;
use std::any::Any;
const CONFIG_BASE_SMALL: bool = false;
const TVN_BITS: usize = 6;
@ -9,8 +10,22 @@ const TVR_SIZE: usize = 1 << TVR_BITS;
const TVN_MASK: usize = TVN_SIZE - 1;
const TVR_MASK: usize = TVR_SIZE - 1;
pub struct TimerList {
pub type TimerWp = Weak::<Rc::<RefCell::<TimerList>>>;
pub struct TimerAttacher {
timers: Rc::<RefCell::<crate::ListHead<TimerAttacher>>>,
}
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>>>,
timer_type: i8,
expire_time: i32,
expires: i64,
cb: fn (i32, Option<Vec<Rc::<dyn Any>>>),
}
pub struct Timer {