Fix re-enqueuing of periodic timers. Fixes #25.

Periodic timers were first re-enqueued and then removed, effectively causing them to stay at their old position, cutting off the tail of the timer queue.
This commit is contained in:
Sönke Ludwig 2017-09-26 15:42:03 +02:00
parent ef7c19d373
commit 60407b783b

View file

@ -51,14 +51,15 @@ final class LoopTimeoutTimerDriver : EventDriverTimers {
if (tm.repeatDuration > 0) {
do tm.timeout += tm.repeatDuration;
while (tm.timeout <= stdtime);
enqueueTimer(tm);
} else tm.pending = false;
m_firedTimers ~= tm;
}
// NOTE: this isn't yet verified to work under all circumstances
foreach (tm; m_firedTimers)
foreach (tm; m_firedTimers) {
m_timerQueue.remove(tm);
if (tm.repeatDuration > 0)
enqueueTimer(tm);
}
foreach (tm; m_firedTimers) {
auto cb = tm.callback;