Subversion Repositories HelenOS

Rev

Rev 2103 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2103 Rev 2106
Line 42... Line 42...
42
typedef void (* timeout_handler_t)(void *arg);
42
typedef void (* timeout_handler_t)(void *arg);
43
 
43
 
44
typedef struct {
44
typedef struct {
45
    SPINLOCK_DECLARE(lock);
45
    SPINLOCK_DECLARE(lock);
46
 
46
 
47
    link_t link;            /**< Link to the list of active timeouts on THE->cpu */
47
    /** Link to the list of active timeouts on THE->cpu */
48
   
48
    link_t link;
49
    uint64_t ticks;         /**< Timeout will be activated in this amount of clock() ticks. */
49
    /** Timeout will be activated in this amount of clock() ticks. */  
50
 
-
 
-
 
50
    uint64_t ticks;
51
    timeout_handler_t handler;  /**< Function that will be called on timeout activation. */
51
    /** Function that will be called on timeout activation. */
-
 
52
    timeout_handler_t handler;
52
    void *arg;          /**< Argument to be passed to handler() function. */
53
    /** Argument to be passed to handler() function. */
53
   
54
    void *arg;
54
    cpu_t *cpu;         /**< On which processor is this timeout registered. */
55
    /** On which processor is this timeout registered. */
-
 
56
    cpu_t *cpu;
55
} timeout_t;
57
} timeout_t;
56
 
58
 
57
#define us2ticks(us)    ((uint64_t) (((uint32_t) (us) / (1000000 / HZ))))
59
#define us2ticks(us)    ((uint64_t) (((uint32_t) (us) / (1000000 / HZ))))
58
 
60
 
59
extern void timeout_init(void);
61
extern void timeout_init(void);
60
extern void timeout_initialize(timeout_t *t);
62
extern void timeout_initialize(timeout_t *t);
61
extern void timeout_reinitialize(timeout_t *t);
63
extern void timeout_reinitialize(timeout_t *t);
62
extern void timeout_register(timeout_t *t, uint64_t usec, timeout_handler_t f, void *arg);
64
extern void timeout_register(timeout_t *t, uint64_t usec, timeout_handler_t f,
-
 
65
    void *arg);
63
extern bool timeout_unregister(timeout_t *t);
66
extern bool timeout_unregister(timeout_t *t);
64
 
67
 
65
#endif
68
#endif
66
 
69
 
67
/** @}
70
/** @}