diff options
Diffstat (limited to 'core/timer.c')
-rw-r--r-- | core/timer.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/timer.c b/core/timer.c index 74a2831d..8c278434 100644 --- a/core/timer.c +++ b/core/timer.c | |||
@@ -104,7 +104,7 @@ void timer_init() | |||
104 | /* Do not depend on fields being zeroed */ | 104 | /* Do not depend on fields being zeroed */ |
105 | static timer* timer_pool; /* timer_pool is SINGLY LINKED!! */ | 105 | static timer* timer_pool; /* timer_pool is SINGLY LINKED!! */ |
106 | 106 | ||
107 | timer* timer_new(void) | 107 | timer* new_timer(void) |
108 | { | 108 | { |
109 | timer* ret; | 109 | timer* ret; |
110 | if (timer_pool) { | 110 | if (timer_pool) { |
@@ -117,7 +117,7 @@ timer* timer_new(void) | |||
117 | return ret; | 117 | return ret; |
118 | } | 118 | } |
119 | 119 | ||
120 | void timer_delete(timer* t) | 120 | void delete_timer(timer* t) |
121 | { | 121 | { |
122 | timer_dequeue(t, &timer_main_queue); | 122 | timer_dequeue(t, &timer_main_queue); |
123 | t->_next = timer_pool; | 123 | t->_next = timer_pool; |
@@ -203,7 +203,7 @@ bool timer_is_active(timer* t) | |||
203 | * Creates a new timer, preforms setup and starts it. */ | 203 | * Creates a new timer, preforms setup and starts it. */ |
204 | void timer_single(timer_callback cb, void* userarg, int sec) | 204 | void timer_single(timer_callback cb, void* userarg, int sec) |
205 | { | 205 | { |
206 | timer* t = timer_new(); | 206 | timer* t = new_timer(); |
207 | timer_setup(t, cb, userarg); | 207 | timer_setup(t, cb, userarg); |
208 | timer_start(t, sec); | 208 | timer_start(t, sec); |
209 | } | 209 | } |
@@ -211,7 +211,7 @@ void timer_single(timer_callback cb, void* userarg, int sec) | |||
211 | /* Single-use microsecond timer. */ | 211 | /* Single-use microsecond timer. */ |
212 | void timer_us(timer_callback cb, void* userarg, int us) | 212 | void timer_us(timer_callback cb, void* userarg, int us) |
213 | { | 213 | { |
214 | timer* t = timer_new(); | 214 | timer* t = new_timer(); |
215 | timer_setup(t, cb, userarg); | 215 | timer_setup(t, cb, userarg); |
216 | t->deadline = current_time() + us; | 216 | t->deadline = current_time() + us; |
217 | t->state = STATE_ACTIVE; | 217 | t->state = STATE_ACTIVE; |
@@ -229,7 +229,7 @@ void timer_poll(void) | |||
229 | timer* t = timer_us_queue; | 229 | timer* t = timer_us_queue; |
230 | timer_dequeue(t, &timer_us_queue); | 230 | timer_dequeue(t, &timer_us_queue); |
231 | t->cb(0, t->userdata); | 231 | t->cb(0, t->userdata); |
232 | timer_delete(t); | 232 | delete_timer(t); |
233 | } | 233 | } |
234 | 234 | ||
235 | if (time - prevtime > US_PER_SECOND || prevtime == 0 || prevtime > time) { | 235 | if (time - prevtime > US_PER_SECOND || prevtime == 0 || prevtime > time) { |
@@ -243,7 +243,7 @@ void timer_poll(void) | |||
243 | int rv = t->cb(t, t->userdata); | 243 | int rv = t->cb(t, t->userdata); |
244 | if (rv != 0) { | 244 | if (rv != 0) { |
245 | timer_dequeue(t, &timer_main_queue); | 245 | timer_dequeue(t, &timer_main_queue); |
246 | timer_delete(t); | 246 | delete_timer(t); |
247 | continue; | 247 | continue; |
248 | } | 248 | } |
249 | if (t->state != STATE_ACTIVE) { | 249 | if (t->state != STATE_ACTIVE) { |