insert timers in the correct order
This commit is contained in:
parent
e5f61d3d99
commit
4cf0d783f7
1 changed files with 7 additions and 7 deletions
|
@ -508,7 +508,7 @@ static void insert_timer(ObMainLoop *loop, ObMainLoopTimer *ins)
|
||||||
GSList *it;
|
GSList *it;
|
||||||
for (it = loop->timers; it; it = g_slist_next(it)) {
|
for (it = loop->timers; it; it = g_slist_next(it)) {
|
||||||
ObMainLoopTimer *t = it->data;
|
ObMainLoopTimer *t = it->data;
|
||||||
if (timecompare(&ins->timeout, &t->timeout) <= 0) {
|
if (timecompare(&ins->timeout, &t->timeout) >= 0) {
|
||||||
loop->timers = g_slist_insert_before(loop->timers, it, ins);
|
loop->timers = g_slist_insert_before(loop->timers, it, ins);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ static void timer_dispatch(ObMainLoop *loop, GTimeVal **wait)
|
||||||
|
|
||||||
/* the queue is sorted, so if this timer shouldn't fire, none are
|
/* the queue is sorted, so if this timer shouldn't fire, none are
|
||||||
ready */
|
ready */
|
||||||
if (timecompare(&NEAREST_TIMEOUT(loop), &loop->now) <= 0)
|
if (timecompare(&NEAREST_TIMEOUT(loop), &loop->now) < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* we set the last fired time to delay msec after the previous firing,
|
/* we set the last fired time to delay msec after the previous firing,
|
||||||
|
|
Loading…
Reference in a new issue