The idea is that every wait() produces exactly one callback unless cancelled.
This commit is contained in:
Sönke Ludwig 2016-12-19 22:21:36 +01:00
parent e33d36eb46
commit 06bcccd6ac

View file

@ -64,9 +64,7 @@ final class LoopTimeoutTimerDriver : EventDriverTimers {
foreach (tm; m_firedTimers) { foreach (tm; m_firedTimers) {
auto cb = tm.callback; auto cb = tm.callback;
if (!tm.pending) { tm.callback = null;
tm.callback = null;
}
if (cb) cb(tm.id); if (cb) cb(tm.id);
} }
@ -139,7 +137,7 @@ final class LoopTimeoutTimerDriver : EventDriverTimers {
final override void wait(TimerID timer, TimerCallback callback) final override void wait(TimerID timer, TimerCallback callback)
{ {
assert(!m_timers[timer].callback); assert(!m_timers[timer].callback, "Calling wait() no a timer that is already waiting.");
m_timers[timer].callback = callback; m_timers[timer].callback = callback;
} }