#include <ArASyncTask.h>
Inheritance diagram for ArASyncTask::
Public Methods | |
ArASyncTask () | |
Constructor. | |
virtual | ~ArASyncTask () |
Destructor. | |
virtual void * | runThread (void *arg)=0 |
The main run loop. More... | |
virtual int | create (bool joinable=true, bool lowerPriority=true) |
Create the task and start it going. | |
virtual void * | runInThisThread (void *arg=0) |
Run the code of the task syncronously. More... |
The ArAsynTask is a task that runs in its own thread. This is a rather simple class. The user simply needs to derive their own class from ArAsyncTask and define the runThread() function. They then need to create an instance of their task and call create(). The standard way to stop a task is to call stopRunning() which sets ArThread::myRunning to false. In their run loop, they should pay attention to the getRunning() or the ArThread::myRunning variable. If this value goes to false, the task should clean up after itself and exit its runThread() function.
|
Run the code of the task syncronously. This will run the code of the ArASyncTask without creating a new thread to run it in. It performs the needed setup then calls runThread(). This is good if you have a task which you wish to run multiple instances of and you want to use the main() thread instead of having it block, waiting for exit of the program.
|
|
The main run loop. Override this function and put your taskes run loop here. Check the value of getRunning() or myRunning periodicly in your loop. If the value goes false, the loop should exit and runThread() should return. Reimplemented in ArRangeDeviceThreaded, ArRecurrentTask, ArSick, and ArSignalHandler. |