Rev 125 | Rev 430 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 125 | Rev 411 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | #include <synch/spinlock.h> |
34 | #include <synch/spinlock.h> |
35 | #include <list.h> |
35 | #include <list.h> |
36 | 36 | ||
37 | #define us2ticks(us) ((__u64)(((__u32) (us)/(1000000/HZ)))) |
37 | #define us2ticks(us) ((__u64)(((__u32) (us)/(1000000/HZ)))) |
38 | 38 | ||
39 | typedef void (* timeout_handler)(void *arg); |
39 | typedef void (* timeout_handler_t)(void *arg); |
40 | 40 | ||
41 | struct timeout { |
41 | struct timeout { |
42 | spinlock_t lock; |
42 | spinlock_t lock; |
43 | 43 | ||
44 | link_t link; |
44 | link_t link; /**< Link to the list of active timeouts on THE->cpu */ |
45 | 45 | ||
46 | __u64 ticks; |
46 | __u64 ticks; /**< Timeout will be activated in this amount of clock() ticks. */ |
47 | 47 | ||
48 | timeout_handler handler; |
48 | timeout_handler_t handler; /**< Function that will be called on timeout activation. */ |
49 | void *arg; |
49 | void *arg; /**< Argument to be passed to handler() function. */ |
50 | 50 | ||
51 | cpu_t *cpu; |
51 | cpu_t *cpu; /**< On which processor is this timeout registered. */ |
52 | }; |
52 | }; |
53 | 53 | ||
54 | extern void timeout_init(void); |
54 | extern void timeout_init(void); |
55 | extern void timeout_initialize(timeout_t *t); |
55 | extern void timeout_initialize(timeout_t *t); |
56 | extern void timeout_reinitialize(timeout_t *t); |
56 | extern void timeout_reinitialize(timeout_t *t); |
57 | extern void timeout_register(timeout_t *t, __u64 usec, timeout_handler f, void *arg); |
57 | extern void timeout_register(timeout_t *t, __u64 usec, timeout_handler_t f, void *arg); |
58 | extern int timeout_unregister(timeout_t *t); |
58 | extern bool timeout_unregister(timeout_t *t); |
59 | 59 | ||
60 | #endif |
60 | #endif |