BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Data Structures | Public Member Functions | Protected Member Functions
BeeeOn::StopControl Class Reference

StopControl implements the stop mechanism generically. More...

#include <StopControl.h>

Data Structures

class  Run
 Helper class for managing a common stoppable loop situation: More...
 

Public Member Functions

bool waitStoppable (const Poco::Timespan &timeout)
 
bool shouldStop () const
 
void requestStop ()
 
void requestWakeup ()
 
void clear ()
 

Protected Member Functions

bool doWait (long ms)
 

Detailed Description

StopControl implements the stop mechanism generically.

Member Function Documentation

void StopControl::clear ( )

Clear the stop request and reinitialize.

bool StopControl::doWait ( long  ms)
protected

Perform the actual m_event.wait() or m_event.tryWait(ms).

void StopControl::requestStop ( )

Request stop. The shouldStop() call would return true until clear() is called.

void StopControl::requestWakeup ( )

Request wakeup (without requesting a stop).

bool StopControl::shouldStop ( ) const
Returns
true to determine whether a stop request has been made.
bool StopControl::waitStoppable ( const Poco::Timespan &  timeout)

Wait for the specified timeout unless a stop is requested. If the timeout is negative, it waits without timeout. Timeout in range 0 < timeout < 1 ms is fixed to be 1 ms.

Returns
true when woken up, false when timeout exceeded

The documentation for this class was generated from the following files: