ia64/xen-unstable

view linux-2.4-xen-sparse/include/linux/timer.h @ 6385:f34e732ed4bf

Xenstore testsuite robustness: save output rather than rerun on failure.
"make check" reruns a test which fails with more verbosity. If the test
fails intermittently, that doesn't work well: save the output and simply
dump it if the test fails.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Aug 23 19:58:59 2005 +0000 (2005-08-23)
parents f294acb25858
children 8799d14bef77 9312a3e8a6f8 23979fb12c49 84ee014ebd41 99914b54f7bf 81576d3d1ca8 3a8f27c6d56c cc5f88b719d0 fa0754a9f64f 112d44270733
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