#include <MultiThreadedAlgorithm.h>

Public Member Functions | |
| AlgorithmThread (int threadIndex, ThreadReporter &reporter) | |
| virtual | ~AlgorithmThread () |
| AlgorithmThread (const AlgorithmThread &thread) | |
| virtual void | run ()=0 |
| bool | launch () |
| bool | wait () |
| void | runInMainThread (ThreadCommand &command) |
| void | setAlgorithmMutex (DMutex *pMutex) |
| void | waitForAlgorithmLoop () |
Static Public Member Functions | |
| static void | threadFunction (AlgorithmThread *pThreadData) |
Protected Member Functions | |
| Range | getThreadRange (int threadCount, int dataSize) const |
| int | getThreadIndex () const |
| ThreadReporter & | getReporter () const |
Classes | |
| class | Range |
| Represents a range in integers. More... | |
Definition at line 271 of file MultiThreadedAlgorithm.h.
| mta::AlgorithmThread::AlgorithmThread | ( | int | threadIndex, | |
| ThreadReporter & | reporter | |||
| ) |
Constructor.
| threadIndex | The ID of this thread. | |
| reporter | Used to report status to the main thread. |
Definition at line 282 of file MultiThreadedAlgorithm.h.
| virtual mta::AlgorithmThread::~AlgorithmThread | ( | ) | [virtual] |
| mta::AlgorithmThread::AlgorithmThread | ( | const AlgorithmThread & | thread | ) |
Copy constructor.
| thread | The other |
Definition at line 299 of file MultiThreadedAlgorithm.h.
| static void mta::AlgorithmThread::threadFunction | ( | AlgorithmThread * | pThreadData | ) | [static] |
The function executed by the underlying threading system.
| pThreadData | The data for the thread being executed. |
| virtual void mta::AlgorithmThread::run | ( | ) | [pure virtual] |
| bool mta::AlgorithmThread::launch | ( | ) |
Launch the thread.
| bool mta::AlgorithmThread::wait | ( | ) |
Wait for thread compltion.
| void mta::AlgorithmThread::runInMainThread | ( | ThreadCommand & | command | ) |
Perform an action in the main thread.
| command | The action to run in the main thread. |
| void mta::AlgorithmThread::setAlgorithmMutex | ( | DMutex * | pMutex | ) |
Set the mutex which synchronizes the threads in an algorithm cluster.
This should be the same object for all threads in the algorithm cluster.
| pMutex | The mutex to synchronize. |
| void mta::AlgorithmThread::waitForAlgorithmLoop | ( | ) |
Wait to begin thread execution.
Synchronizes start-up among all threads in an algorithm cluster.
| Range mta::AlgorithmThread::getThreadRange | ( | int | threadCount, | |
| int | dataSize | |||
| ) | const [protected] |
Calculate the range of values for which a thread is responsible.
| threadCount | The total number of threads in an algorithm cluster. | |
| dataSize | The total number of items which need to be processed. |
| int mta::AlgorithmThread::getThreadIndex | ( | ) | const [protected] |
Get the id of this thread.
| ThreadReporter& mta::AlgorithmThread::getReporter | ( | ) | const [protected] |
Get the object which this thread can use to report status.