Convert UCTimers to use UCoreClock
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
struct UCTimer;
|
||||
struct UCTimers;
|
||||
struct UCoreClock;
|
||||
|
||||
//internal timer states
|
||||
enum {
|
||||
@@ -62,6 +63,7 @@ struct UCTimer {
|
||||
/** Timer engine. Must be initialized onnce.*/
|
||||
struct UCTimers {
|
||||
RBTree timer_tree;
|
||||
struct UCoreClock *uclock;
|
||||
size_t seq; //used to generate unique timers
|
||||
TAILQ_HEAD(, UCTimer) ready_list; //pending timers to be fired while inside uc_timers_run
|
||||
};
|
||||
@@ -73,6 +75,12 @@ struct UCTimers {
|
||||
*/
|
||||
void uc_timers_init(struct UCTimers *t);
|
||||
|
||||
/** Initialize a timer engine for use, with a user supplied clock.
|
||||
*
|
||||
* @param t UCTimers struct to initialize
|
||||
*/
|
||||
void uc_timers_init_ex(struct UCTimers *t, struct UCoreClock *uclock);
|
||||
|
||||
/** Add a (one-shot) timer to the timer engine.
|
||||
* User fills in the callback and any cookie members of the UCTimer. The callback
|
||||
* will be called when the timer expires, and the timer is removed from the engine
|
||||
@@ -127,7 +135,7 @@ int uc_timer_running(const struct UCTimer *timer);
|
||||
* @return the number of timers fired, or negative if an error occured(presently no errors
|
||||
* are possible and the return value is always >= 0
|
||||
**/
|
||||
int uc_timers_run(struct UCTimers *timers, const struct timeval *now);
|
||||
int uc_timers_run(struct UCTimers *timers);
|
||||
|
||||
//uc_timers_destroy(struct UCTimers *timers) is currently missing..
|
||||
|
||||
|
||||
Reference in New Issue
Block a user