Fixed nasty hub freeze caused by timers being injected for the same timestamp as it is being removed from.
This commit is contained in:
parent
c4604a7e94
commit
8bed952022
@ -54,10 +54,11 @@ void timeout_queue_shutdown(struct timeout_queue* t)
|
|||||||
|
|
||||||
size_t timeout_queue_process(struct timeout_queue* t, time_t now)
|
size_t timeout_queue_process(struct timeout_queue* t, time_t now)
|
||||||
{
|
{
|
||||||
size_t pos;
|
size_t pos = t->last;
|
||||||
size_t events = 0;
|
size_t events = 0;
|
||||||
struct timeout_evt* evt = 0;
|
struct timeout_evt* evt = 0;
|
||||||
for (pos = t->last; pos <= now; pos++)
|
t->last = now;
|
||||||
|
for (; pos <= now; pos++)
|
||||||
{
|
{
|
||||||
while ((evt = t->events[pos % t->max]))
|
while ((evt = t->events[pos % t->max]))
|
||||||
{
|
{
|
||||||
@ -66,7 +67,6 @@ size_t timeout_queue_process(struct timeout_queue* t, time_t now)
|
|||||||
events++;
|
events++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t->last = now;
|
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user