Looper: implementation
This commit is contained in:
parent
be97473779
commit
af92ed505b
2 changed files with 9 additions and 4 deletions
|
|
@ -77,6 +77,7 @@ 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 ;
|
||||||
|
|
|
||||||
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue