From f41a0aea38bee37c9c537ba5420fdd2cb2e99dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Tue, 31 May 2016 13:53:19 +0200 Subject: [PATCH] lx_kit: handle multiple timer at once Issue #1986. --- repos/dde_linux/src/lx_kit/timer.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/repos/dde_linux/src/lx_kit/timer.cc b/repos/dde_linux/src/lx_kit/timer.cc index 24acede156..cc53c9ee2d 100644 --- a/repos/dde_linux/src/lx_kit/timer.cc +++ b/repos/dde_linux/src/lx_kit/timer.cc @@ -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(); }