From af92ed505bd7c5e4f640fcda63caca191fe1f761 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 16 Dec 2016 18:34:04 +0100 Subject: [PATCH] Looper: implementation --- src/proc/control/looper.hpp | 10 ++++++++-- tests/core/proc/control/dispatcher-looper-test.cpp | 3 +-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/proc/control/looper.hpp b/src/proc/control/looper.hpp index ad6866770..ae80effc5 100644 --- a/src/proc/control/looper.hpp +++ b/src/proc/control/looper.hpp @@ -77,7 +77,8 @@ namespace control { */ class Looper { - + bool shutdown = false; + public: Looper() { } @@ -88,7 +89,7 @@ namespace control { bool isIdle() const { return false; } bool needBuild() const { return false; } bool isDisabled() const { return false; } - bool isDying() const { return false; } + bool isDying() const { return shutdown; } /** state fusion to control (timed) wait */ @@ -115,6 +116,11 @@ namespace control { } + void + triggerShutdown() + { + shutdown = true; + } /* == diagnostics == */ // size_t size() const ; diff --git a/tests/core/proc/control/dispatcher-looper-test.cpp b/tests/core/proc/control/dispatcher-looper-test.cpp index 408fcd600..91c5e2c5d 100644 --- a/tests/core/proc/control/dispatcher-looper-test.cpp +++ b/tests/core/proc/control/dispatcher-looper-test.cpp @@ -52,7 +52,6 @@ namespace test { */ struct Setup { - bool shutdown = false; Looper install() @@ -118,7 +117,7 @@ namespace test { CHECK (not looper.isDying()); CHECK (looper.shallLoop()); - setup.shutdown = true; + looper.triggerShutdown(); CHECK (looper.isDying()); CHECK (not looper.shallLoop()); }