#include <ArPeriodicTask.h>
Public Methods | |
ArPeriodicTask () | |
Constructor. | |
virtual | ~ArPeriodicTask () |
Destructor. | |
virtual bool | invoke () |
Invoke the task. | |
virtual void | runTask ()=0 |
Function to override for the task. | |
void | setRunning (bool yesno) |
Function to set the task's running variable. | |
bool | isRunning () |
Function to tell if the task is running. |
This class is a base class for running periodic tasks that need to be run in their own thread. Since the tasks are periodic and dont need to be run constantly, they dont need their own thread all the time. Since threads can be a restricted resource, there is this periodic task. The user simply needs to derive their own class from ArPeriodicTask and override the runTask() function. The function is guarenteed to be run in its own thread. It can run as long as it wants and when its done the thread will be released to be used by another ArPeriodicTask that may need it. To run the task, simply call invoke() on it. The invoke() can be called multiple times.
See also ArTaskPool.