This commit is contained in:
aozhiwei 2023-10-07 19:28:42 +08:00
parent ab32db98cf
commit 51ffb10af3

View File

@ -1,6 +1,14 @@
use std::rc::{Rc, Weak}; use std::rc::{Rc, Weak};
use std::cell::RefCell; use std::cell::RefCell;
const CONFIG_BASE_SMALL: bool = false;
const TVN_BITS: i32 = 6;
const TVR_BITS: i32 = 8;
const TVN_SIZE: i32 = 1 << TVN_BITS;
const TVR_SIZE: i32 = 1 << TVR_BITS;
const TVN_MASK: i32 = TVN_SIZE - 1;
const TVR_MASK: i32 = TVR_SIZE - 1;
pub struct TimerList { pub struct TimerList {
} }
@ -9,14 +17,15 @@ pub struct Timer {
free_timer_num: i32, free_timer_num: i32,
free_timer_list: Rc::<RefCell::<crate::ListHead<TimerList>>>, free_timer_list: Rc::<RefCell::<crate::ListHead<TimerList>>>,
running_timer: Weak::<RefCell::<TimerList>>, running_timer: Weak::<RefCell::<TimerList>>,
timer_tick: i64,
get_tick_count: fn () -> i64,
cache_timer_num: i32,
} }
impl Timer { impl Timer {
pub fn init(&mut self, pub fn init(&mut self,
get_tick_count: fn () -> i64, get_tick_count: fn () -> i64,
get_fxied_timer_expires: fn (i32, i64) -> i64,
context: (),
gctime: i32, gctime: i32,
cache_timer_num: i32) { cache_timer_num: i32) {