1
This commit is contained in:
parent
ab32db98cf
commit
51ffb10af3
13
src/timer.rs
13
src/timer.rs
@ -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) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user