The periodic task executes one thread method repeatedly using the time period specified in the constructor.
More...
#include <ArmarXCore/core/services/tasks/PeriodicTask.h>
template<class
T>
class armarx::PeriodicTask< T >
The periodic task executes one thread method repeatedly using the time period specified in the constructor.
◆ method_type
| typedef void(T::* method_type) (void) |
Typedef for the periodic method.
Thread methods need to follow the template void methodName(void). Parameter passing is not used since methods are members of the class.
◆ pointer_type
Shared pointer type for convenience.
◆ PeriodicTask()
| PeriodicTask |
( |
T * | parent, |
|
|
method_type | periodicFn, |
|
|
int | periodMs, |
|
|
bool | assureMeanInterval = false, |
|
|
std::string | name = "", |
|
|
bool | forceSystemTime = true ) |
|
inline |
Constructs a periodic task within the class parent which calls the peridoicFn in a new thread.
- Parameters
-
| parent | the class wheter periodicFn is member |
| peridicFn | reference to the periodic function implementation |
| periodMs | period time in milliseconds |
| assureMeanInterval | If set to TRUE, the scheduler tries to compensate timeslot exceedings overtime and not only on the next interval |
| name | of this thread, that describes what it is doing |
| forceSystemTime | If set to false, the Timeserver will be used for timing (if available) |
◆ ~PeriodicTask()
Destructor stops the thread and waits for completion.
◆ changeInterval()
| void changeInterval |
( |
unsigned int | intervalInMs | ) |
|
|
inline |
changeInterval changes the interval at which the task is executed.
The execution starts the first time again after the duration specified in the parameter OR if the task is currently executed after this task
- the interval specified - cycleDuration.
- Parameters
-
| intervalInMs | new execution interval in milliseconds. |
◆ getInterval()
| IceUtil::Int64 getInterval |
( |
| ) |
const |
|
inline |
- Returns
- The scheduling interval of the thread instance in milliseconds
◆ getStatistics()
| const PeriodicTaskIceBase & getStatistics |
( |
| ) |
const |
|
inline |
- Returns
- PeriodicTaskIceBase base pointer to the current PeriodicTask instance
◆ isFunctionExecuting()
| bool isFunctionExecuting |
( |
| ) |
const |
|
inline |
Return the execution state of the thread function.
- Returns
- PeriodicTask::functionExecuting
◆ isRunning()
Retrieve running state of the thread.
- Returns
- whether thread is running
◆ setDelayWarningTolerance()
| void setDelayWarningTolerance |
( |
int | newToleranceInMilliSeconds = 5 | ) |
|
|
inline |
- Returns
- Set the tolerance value for delay warnings. If the tasks takes longer than (scheduling interval + tolerance), a warning is issued.
- Parameters
-
| newToleranceInMilliSeconds | The tolerance, in milliseconds. |
◆ setName()
| void setName |
( |
std::string | name | ) |
|
|
inline |
Set the name identifying PeriodicTask instances.
- Parameters
-
| name | string containing the name |
◆ setThreadList()
This method sets threadList as PeriodicTask::customThreadList and appends this to the list.
- Parameters
-
◆ start()
Starts the thread.
Only has effect if the task has not been started. After completion of the task, it can be started again (see isRunning()).
◆ stop()
Stops the thread.
Only has effect if the task has been started.
The documentation for this class was generated from the following files: