Aria: ArASyncTask Class Reference

- Main Page
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ArASyncTask Class Reference

`#include <ArASyncTask.h>`

Inheritance diagram for ArASyncTask:

List of all members.

## Detailed Description

Asynchronous task (runs in its own thread).

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 run or runAsync. 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.

## Public Member Functions
| ArASyncTask ()
| Constructor.
virtual int | create (bool joinable=true, bool lowerPriority=true)
| Create the task and start it going.
virtual const char * | getThreadActivity (void)
virtual void | run (void)
| Run without creating a new thread.
virtual void | runAsync (void)
| Run in its own thread.
virtual void * | runInThisThread (void *arg=0)
virtual void * | runThread (void *arg)=0
| The main run loop.
virtual void | stopRunning (void)
| Stop the thread.
virtual | ~ArASyncTask ()
| Destructor.

## Member Function Documentation

virtual const char* ArASyncTask::getThreadActivity | ( | void |  | ) | `[inline, virtual]`

Gets a string that describes what the thread is doing, or NULL if it doesn't know. Override this in your subclass to return a status string. This can be used for debugging or UI display.

Reimplemented from ArThread.

virtual void ArASyncTask::run | ( | void |  | ) | `[inline, virtual]`

Run without creating a new thread.

This will run the the ArASyncTask without creating a new thread to run it in. It performs the needed setup then calls runThread() directly instead of letting the system threading system do it in a new thread.

Reimplemented in ArSoundsQueue.

virtual void* ArASyncTask::runInThisThread | ( | void * | arg = `0` | ) | `[virtual]`

Internal function used with system threading system to run the new thread. In general, use run() or runAsync() instead.

virtual void* ArASyncTask::runThread | ( | void * | arg | ) | `[pure virtual]`

The main run loop.

Override this function and put your taskes run loop here. Check the value of getRunning() periodicly in your loop. If the value is false, the loop should exit and runThread() should return. The argument and return value are specific to the platform thread implementation, and can be ignored.

Java and Python Wrappers: In the wrapper libraries, this method takes no arguments and has no return value.

Implemented in ArFunctorASyncTask, and ArSoundsQueue.

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

- ArASyncTask.h