17 #error do not include tw_timer_template.h directly 24 #define _twt(a,b) a##b##_t 25 #define __twt(a,b) _twt(a,b) 26 #define TWT(a) __twt(a,TW_SUFFIX) 29 #define __tw(a,b) _tw(a,b) 30 #define TW(a) __tw(a,TW_SUFFIX) 118 #if TW_TIMER_WHEELS > 0 120 u16 fast_ring_offset;
131 #ifndef __defined_tw_timer_wheel_slot__ 132 #define __defined_tw_timer_wheel_slot__ 174 void (*expired_timer_callback) (
u32 * expired_timer_handles);
181 }
TWT (tw_timer_wheel);
184 u32 pool_index,
u32 timer_id,
u32 interval);
189 void *expired_timer_callback,
190 f64 timer_interval,
u32 max_expirations);
void TW() tw_timer_wheel_free(TWT(tw_timer_wheel)*tw)
Free a tw timer wheel template instance.
u8 pad[3]
log2 (size of the packing page block)
void TW() tw_timer_wheel_init(TWT(tw_timer_wheel)*tw, void *expired_timer_callback, f64 timer_interval, u32 max_expirations)
Initialize a tw timer wheel template instance.
Fixed length block allocator.
u32 max_expirations
maximum expirations
f64 timer_interval
Timer interval, also needed to avoid fp divide in speed path.
u32 current_tick
current tick
static timer_callback_t * timers
#define TW_SLOTS_PER_RING
u32 TW() tw_timer_start(TWT(tw_timer_wheel)*tw, u32 pool_index, u32 timer_id, u32 interval)
Start a Tw Timer.
void TW() tw_timer_stop(TWT(tw_timer_wheel)*tw, u32 handle)
Stop a tw timer.
f64 next_run_time
Next time the wheel should run.
u32 next
next, previous pool indices
u32 * expired_timer_handles
vector of expired timers
u32 TW() tw_timer_expire_timers(TWT(tw_timer_wheel)*tw, f64 now)
Advance a tw timer wheel.
f64 ticks_per_second
Timer ticks per second.
f64 last_run_time
Last time the wheel ran.
u32 user_handle
user timer handle
u32 head_index
Listhead of timers which expire in this interval.