ia64/xen-unstable

view linux-2.4.29-xen-sparse/include/linux/timer.h @ 3516:1a4f61d36171

bitkeeper revision 1.1159.223.31 (41f599bcklevTYwPtWQUZ7QK-azDbg)

Fix recent patch to change the way the version string is generated.
Signed-off-by: ian.pratt@cl.cam.ac.uk
author iap10@freefall.cl.cam.ac.uk
date Tue Jan 25 00:58:36 2005 +0000 (2005-01-25)
parents ed0d4ce83995
children d126cac32f08
line source
1 #ifndef _LINUX_TIMER_H
2 #define _LINUX_TIMER_H
4 #include <linux/config.h>
5 #include <linux/list.h>
7 /*
8 * In Linux 2.4, static timers have been removed from the kernel.
9 * Timers may be dynamically created and destroyed, and should be initialized
10 * by a call to init_timer() upon creation.
11 *
12 * The "data" field enables use of a common timeout function for several
13 * timeouts. You can use this field to distinguish between the different
14 * invocations.
15 */
16 struct timer_list {
17 struct list_head list;
18 unsigned long expires;
19 unsigned long data;
20 void (*function)(unsigned long);
21 };
23 extern void add_timer(struct timer_list * timer);
24 extern int del_timer(struct timer_list * timer);
25 #ifdef CONFIG_NO_IDLE_HZ
26 extern struct timer_list *next_timer_event(void);
27 #endif
29 #ifdef CONFIG_SMP
30 extern int del_timer_sync(struct timer_list * timer);
31 extern void sync_timers(void);
32 #else
33 #define del_timer_sync(t) del_timer(t)
34 #define sync_timers() do { } while (0)
35 #endif
37 /*
38 * mod_timer is a more efficient way to update the expire field of an
39 * active timer (if the timer is inactive it will be activated)
40 * mod_timer(a,b) is equivalent to del_timer(a); a->expires = b; add_timer(a).
41 * If the timer is known to be not pending (ie, in the handler), mod_timer
42 * is less efficient than a->expires = b; add_timer(a).
43 */
44 int mod_timer(struct timer_list *timer, unsigned long expires);
46 extern void it_real_fn(unsigned long);
48 static inline void init_timer(struct timer_list * timer)
49 {
50 timer->list.next = timer->list.prev = NULL;
51 }
53 static inline int timer_pending (const struct timer_list * timer)
54 {
55 return timer->list.next != NULL;
56 }
58 /*
59 * These inlines deal with timer wrapping correctly. You are
60 * strongly encouraged to use them
61 * 1. Because people otherwise forget
62 * 2. Because if the timer wrap changes in future you wont have to
63 * alter your driver code.
64 *
65 * time_after(a,b) returns true if the time a is after time b.
66 *
67 * Do this with "<0" and ">=0" to only test the sign of the result. A
68 * good compiler would generate better code (and a really good compiler
69 * wouldn't care). Gcc is currently neither.
70 */
71 #define time_after(a,b) ((long)(b) - (long)(a) < 0)
72 #define time_before(a,b) time_after(b,a)
74 #define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
75 #define time_before_eq(a,b) time_after_eq(b,a)
77 #endif