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) {
Lx::scheduler().current()->block_and_schedule();
Lx_kit::Timer::Context *ctx = t.first();
if (!ctx || ctx->timeout > t.jiffies())
continue;;
while (Lx_kit::Timer::Context *ctx = t.first()) {
if (ctx->timeout > t.jiffies()) {
break;
}
ctx->pending = false;
ctx->function();
ctx->pending = false;
ctx->function();
if (!ctx->pending)
t.del(ctx->timer);
if (!ctx->pending) {
t.del(ctx->timer);
}
}
t.schedule_next();
}