RSC  0.17.1
rsc::threading::PeriodicTask Class Reference

A specialization of Task that executes a task in a periodic manner by providing an special implementation of continueExec. More...

#include <PeriodicTask.h>

Inheritance diagram for rsc::threading::PeriodicTask:
Inheritance graph
Collaboration diagram for rsc::threading::PeriodicTask:
Collaboration graph

Public Member Functions

 PeriodicTask (const unsigned int &ms, bool accountProcTime=true)
 Constructs a new periodic task with a fixed wait time after each iteration. More...
 
virtual ~PeriodicTask ()
 
virtual bool continueExec ()
 Implements a waiting logic for the continuation of the repetitive task. More...
 
- Public Member Functions inherited from rsc::threading::RepetitiveTask
 RepetitiveTask ()
 
virtual ~RepetitiveTask ()
 
virtual void pre ()
 A method called before each iteration of the task. More...
 
virtual void execute ()=0
 This method is invoked to perform the real work of the task. More...
 
virtual void post ()
 A method called after each iteration of the task. More...
 
virtual void cancel ()
 Interrupts the task. More...
 
virtual bool isCancelRequested ()
 Tells whether the task was interrupted by a call to cancel. More...
 
void run ()
 Performs the real task work orchestrating the iterative loop with the different hook methods and so on. More...
 
virtual void waitDone ()
 Waits for the execution of this task to finish. More...
 
virtual bool isDone ()
 Indicates whether the task finished execution, either through being canceled or through successfully ending. More...
 
- Public Member Functions inherited from rsc::threading::Task
virtual ~Task ()
 

Private Attributes

unsigned int cycleTime
 
rsc::logging::LoggerPtr logger
 
bool fixedScheduling
 
boost::uint64_t nextProcessingStart
 

Additional Inherited Members

- Protected Attributes inherited from rsc::threading::RepetitiveTask
boost::recursive_mutex doneMutex
 
boost::condition doneCondition
 

Detailed Description

A specialization of Task that executes a task in a periodic manner by providing an special implementation of continueExec.

A fixed interval is guaranteed.

Author
swrede
jwienke
anordman

Definition at line 47 of file PeriodicTask.h.

Constructor & Destructor Documentation

rsc::threading::PeriodicTask::PeriodicTask ( const unsigned int &  ms,
bool  accountProcTime = true 
)

Constructs a new periodic task with a fixed wait time after each iteration.

Parameters
mstime to wait between iterations. No overall-fixed interval is guaranteed by the implementation. Time is in milliseconds.
accountProcTimesubtracts the processing time from sleep time in order to guarantee a fixed scheduling interval

Definition at line 34 of file PeriodicTask.cpp.

rsc::threading::PeriodicTask::~PeriodicTask ( )
virtual

Definition at line 40 of file PeriodicTask.cpp.

References logger, and RSCTRACE.

Member Function Documentation

bool rsc::threading::PeriodicTask::continueExec ( )
virtual

Implements a waiting logic for the continuation of the repetitive task.

Returns
until the task is canceled after having waited for the specified amount of time.

Reimplemented from rsc::threading::RepetitiveTask.

Definition at line 44 of file PeriodicTask.cpp.

References rsc::misc::currentTimeMicros(), cycleTime, fixedScheduling, rsc::threading::RepetitiveTask::isCancelRequested(), logger, nextProcessingStart, RSCTRACE, and RSCWARN.

Here is the call graph for this function:

Member Data Documentation

unsigned int rsc::threading::PeriodicTask::cycleTime
private

Definition at line 72 of file PeriodicTask.h.

Referenced by continueExec().

bool rsc::threading::PeriodicTask::fixedScheduling
private

Definition at line 74 of file PeriodicTask.h.

Referenced by continueExec().

rsc::logging::LoggerPtr rsc::threading::PeriodicTask::logger
private

Definition at line 73 of file PeriodicTask.h.

Referenced by continueExec(), and ~PeriodicTask().

boost::uint64_t rsc::threading::PeriodicTask::nextProcessingStart
private

Definition at line 75 of file PeriodicTask.h.

Referenced by continueExec().


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