1
This commit is contained in:
parent
b246bd745a
commit
f87e9107f5
17
src/timer.rs
17
src/timer.rs
@ -1,5 +1,6 @@
|
|||||||
use std::rc::{Rc, Weak};
|
use std::rc::{Rc, Weak};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
use std::any::Any;
|
||||||
|
|
||||||
const CONFIG_BASE_SMALL: bool = false;
|
const CONFIG_BASE_SMALL: bool = false;
|
||||||
const TVN_BITS: usize = 6;
|
const TVN_BITS: usize = 6;
|
||||||
@ -9,8 +10,22 @@ const TVR_SIZE: usize = 1 << TVR_BITS;
|
|||||||
const TVN_MASK: usize = TVN_SIZE - 1;
|
const TVN_MASK: usize = TVN_SIZE - 1;
|
||||||
const TVR_MASK: usize = TVR_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 {
|
pub struct Timer {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user