lx_kit: handle multiple timer at once

Issue #1986.
This commit is contained in:
Josef Söntgen
2016-05-31 13:53:19 +02:00
committed by Christian Helmuth
parent 294c7e5076
commit f41a0aea38

View File

@ -194,15 +194,18 @@ class Lx_kit::Timer : public Lx::Timer
while (1) { while (1) {
Lx::scheduler().current()->block_and_schedule(); Lx::scheduler().current()->block_and_schedule();
Lx_kit::Timer::Context *ctx = t.first(); while (Lx_kit::Timer::Context *ctx = t.first()) {
if (!ctx || ctx->timeout > t.jiffies()) if (ctx->timeout > t.jiffies()) {
continue;; break;
}
ctx->pending = false; ctx->pending = false;
ctx->function(); ctx->function();
if (!ctx->pending) if (!ctx->pending) {
t.del(ctx->timer); t.del(ctx->timer);
}
}
t.schedule_next(); t.schedule_next();
} }