diff --git a/include/ucore/ucore_timers.h b/include/ucore/ucore_timers.h index 0d97d05..c950e83 100644 --- a/include/ucore/ucore_timers.h +++ b/include/ucore/ucore_timers.h @@ -61,7 +61,7 @@ struct UCTimer { /** Timer engine. Must be initialized onnce.*/ struct UCTimers { - RBTree timers; + RBTree timer_tree; size_t seq; //used to generate unique timers TAILQ_HEAD(, UCTimer) ready_list; //pending timers to be fired while inside uc_timers_run }; diff --git a/src/ucore_timers.c b/src/ucore_timers.c index cefbf7f..c0751e1 100644 --- a/src/ucore_timers.c +++ b/src/ucore_timers.c @@ -31,13 +31,13 @@ static void uc_timer_real_add(struct UCTimers *timers, struct UCTimer *timer) timer->state = UC_TIMER_ACTIVE; timer->seq = timers->seq++; timer->rb_node.data = timer; //point the data in a RBNode back to the timer that contains it. - uc_rb_insert(&timers->timers, &timer->rb_node); + uc_rb_insert(&timers->timer_tree, &timer->rb_node); } void uc_timers_init(struct UCTimers *t) { - t->timers.node = NULL; - t->timers.compare = timers_cmp; + t->timer_tree.node = NULL; + t->timer_tree.compare = timers_cmp; t->seq = 0; TAILQ_INIT(&t->ready_list); } @@ -68,7 +68,7 @@ void uc_timer_remove(struct UCTimers *timers, struct UCTimer *timer) return; } - uc_rb_remove(&timers->timers, &timer->rb_node); //remove it, safe for the + uc_rb_remove(&timers->timer_tree, &timer->rb_node); //remove it, safe for the //callback to re_add it if (timer->state == UC_TIMER_PENDING) { //timer is pending for callback, remove it from the list @@ -80,7 +80,7 @@ void uc_timer_remove(struct UCTimers *timers, struct UCTimer *timer) int uc_timers_first(const struct UCTimers *timers, struct timeval *first) { - const RBNode *n = uc_rb_first(&timers->timers); + const RBNode *n = uc_rb_first(&timers->timer_tree); if (n) { struct UCTimer *timer = n->data; *first = timer->timeout; @@ -95,7 +95,7 @@ size_t uc_timer_count(const struct UCTimers *timers) struct RBNode *n; size_t count = 0; - for (n = uc_rb_first(&timers->timers); n ; n = uc_rb_next(n)) { + for (n = uc_rb_first(&timers->timer_tree); n ; n = uc_rb_next(n)) { count++; } @@ -119,7 +119,7 @@ int uc_timers_run(struct UCTimers *timers, const struct timeval *now) */ assert(TAILQ_EMPTY(&timers->ready_list)); //somethings serious wrong if it isn't already empty TAILQ_INIT(&timers->ready_list); - for (node = uc_rb_first(&timers->timers); node ; node = uc_rb_next(node)) { + for (node = uc_rb_first(&timers->timer_tree); node ; node = uc_rb_next(node)) { struct UCTimer *t = node->data; //Note, timercmp does not work for >= if (!timercmp(now, &t->timeout, <)) {