Looper: implementation

This commit is contained in:
Fischlurch 2016-12-16 18:34:04 +01:00
parent be97473779
commit af92ed505b
2 changed files with 9 additions and 4 deletions

View file

@ -77,7 +77,8 @@ namespace control {
*/ */
class Looper class Looper
{ {
bool shutdown = false;
public: public:
Looper() Looper()
{ } { }
@ -88,7 +89,7 @@ namespace control {
bool isIdle() const { return false; } bool isIdle() const { return false; }
bool needBuild() const { return false; } bool needBuild() const { return false; }
bool isDisabled() const { return false; } bool isDisabled() const { return false; }
bool isDying() const { return false; } bool isDying() const { return shutdown; }
/** state fusion to control (timed) wait */ /** state fusion to control (timed) wait */
@ -115,6 +116,11 @@ namespace control {
} }
void
triggerShutdown()
{
shutdown = true;
}
/* == diagnostics == */ /* == diagnostics == */
// size_t size() const ; // size_t size() const ;

View file

@ -52,7 +52,6 @@ namespace test {
*/ */
struct Setup struct Setup
{ {
bool shutdown = false;
Looper Looper
install() install()
@ -118,7 +117,7 @@ namespace test {
CHECK (not looper.isDying()); CHECK (not looper.isDying());
CHECK (looper.shallLoop()); CHECK (looper.shallLoop());
setup.shutdown = true; looper.triggerShutdown();
CHECK (looper.isDying()); CHECK (looper.isDying());
CHECK (not looper.shallLoop()); CHECK (not looper.shallLoop());
} }