1
This commit is contained in:
parent
c7dae045be
commit
7e0ba5ccd1
@ -1,6 +1,7 @@
|
||||
use std::rc::{Rc, Weak};
|
||||
use std::cell::RefCell;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct ListHead<T> {
|
||||
prev: Weak::<RefCell::<ListHead<T>>>,
|
||||
next: Weak::<RefCell::<ListHead<T>>>,
|
||||
|
18
src/timer.rs
18
src/timer.rs
@ -12,10 +12,12 @@ const TVR_MASK: usize = TVR_SIZE - 1;
|
||||
|
||||
pub type TimerWp = Weak::<Rc::<RefCell::<TimerList>>>;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TimerAttacher {
|
||||
timers: Rc::<RefCell::<crate::ListHead<TimerAttacher>>>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct TimerList {
|
||||
holder: Rc::<RefCell::<TimerList>>,
|
||||
wp: Rc::<Rc::<RefCell::<TimerList>>>,
|
||||
@ -25,7 +27,7 @@ struct TimerList {
|
||||
expire_time: i32,
|
||||
expires: i64,
|
||||
|
||||
cb: fn (i32, Option<Vec<Rc::<dyn Any>>>),
|
||||
//cb: fn (i32, Option<Vec<Rc::<dyn Any>>>),
|
||||
}
|
||||
|
||||
pub struct Timer {
|
||||
@ -73,6 +75,20 @@ impl Timer {
|
||||
|
||||
}
|
||||
|
||||
fn new_timer_list(&mut self) -> Rc::<RefCell::<TimerList>> {
|
||||
let p = Rc::new(RefCell::new(TimerList{
|
||||
holder: Default::default(),
|
||||
wp: Default::default(),
|
||||
timer_entry: Default::default(),
|
||||
attach_entry: Default::default(),
|
||||
timer_type: 0,
|
||||
expire_time: 0,
|
||||
expires: 0,
|
||||
//cb: Default::default(),
|
||||
}));
|
||||
return p;
|
||||
}
|
||||
|
||||
pub fn update(&mut self) {
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user