1 #ifndef __TOOLS_LINUX_TIMER_H
2 #define __TOOLS_LINUX_TIMER_H
5 #include <linux/types.h>
9 void (*function)(struct timer_list *timer);
13 static inline void timer_setup(struct timer_list *timer,
14 void (*func)(struct timer_list *),
17 memset(timer, 0, sizeof(*timer));
18 timer->function = func;
21 #define timer_setup_on_stack(timer, callback, flags) \
22 timer_setup(timer, callback, flags)
24 #define destroy_timer_on_stack(timer) do {} while (0)
26 static inline int timer_pending(const struct timer_list *timer)
28 return timer->pending;
31 int del_timer(struct timer_list * timer);
32 int del_timer_sync(struct timer_list *timer);
34 #define del_singleshot_timer_sync(timer) del_timer_sync(timer)
36 int mod_timer(struct timer_list *timer, unsigned long expires);
38 static inline void add_timer(struct timer_list *timer)
40 BUG_ON(timer_pending(timer));
41 mod_timer(timer, timer->expires);
44 void flush_timers(void);
46 #endif /* __TOOLS_LINUX_TIMER_H */