From 07c0fbdcb32330dc74e90d623f3a84b88407ace6 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Thu, 12 Jan 2017 23:33:14 +0100 Subject: [PATCH] fix(timer_module): Sleep at beginning since already warmed up --- include/modules/meta/timer_module.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/modules/meta/timer_module.hpp b/include/modules/meta/timer_module.hpp index f533174b..32395da6 100644 --- a/include/modules/meta/timer_module.hpp +++ b/include/modules/meta/timer_module.hpp @@ -21,16 +21,17 @@ namespace modules { void runner() { try { while (this->running()) { + this->sleep(m_interval); + + if (!this->running()) { + break; + } + std::unique_lock guard(this->m_updatelock); if (CAST_MOD(Impl)->update()) { this->broadcast(); } - - if (this->running()) { - guard.unlock(); - this->sleep(m_interval); - } } } catch (const exception& err) { this->halt(err.what());