mta::AlgorithmThread Class Reference

Base class for an algorithm thread. More...

#include <MultiThreadedAlgorithm.h>

Inheritance diagram for mta::AlgorithmThread:

Inheritance graph

List of all members.

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
ThreadReportergetReporter () const

Classes

class  Range
 Represents a range in integers. More...


Detailed Description

Base class for an algorithm thread.

Definition at line 271 of file MultiThreadedAlgorithm.h.


Constructor & Destructor Documentation

mta::AlgorithmThread::AlgorithmThread ( int  threadIndex,
ThreadReporter reporter 
)

Constructor.

Parameters:
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]

Destructor.

Definition at line 291 of file MultiThreadedAlgorithm.h.

mta::AlgorithmThread::AlgorithmThread ( const AlgorithmThread thread  ) 

Copy constructor.

Parameters:
thread The other

Definition at line 299 of file MultiThreadedAlgorithm.h.


Member Function Documentation

static void mta::AlgorithmThread::threadFunction ( AlgorithmThread pThreadData  )  [static]

The function executed by the underlying threading system.

Parameters:
pThreadData The data for the thread being executed.

virtual void mta::AlgorithmThread::run (  )  [pure virtual]

Execute the thread.

Implements mta::ThreadCommand.

bool mta::AlgorithmThread::launch (  ) 

Launch the thread.

Returns:
False if there was an error.

bool mta::AlgorithmThread::wait (  ) 

Wait for thread compltion.

Returns:
False if there was an error.

void mta::AlgorithmThread::runInMainThread ( ThreadCommand command  ) 

Perform an action in the main thread.

Parameters:
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.

Parameters:
pMutex The mutex to synchronize.

void mta::AlgorithmThread::waitForAlgorithmLoop (  ) 

Wait to begin thread execution.

Synchronizes start-up among all threads in an algorithm cluster.

See also:
setAlgorithmMutex()

Range mta::AlgorithmThread::getThreadRange ( int  threadCount,
int  dataSize 
) const [protected]

Calculate the range of values for which a thread is responsible.

Parameters:
threadCount The total number of threads in an algorithm cluster.
dataSize The total number of items which need to be processed.
Returns:
The range of items which this thread will process.

int mta::AlgorithmThread::getThreadIndex (  )  const [protected]

Get the id of this thread.

Returns:
The id of this thread.

ThreadReporter& mta::AlgorithmThread::getReporter (  )  const [protected]

Get the object which this thread can use to report status.

Returns:
The object used to report status.


Software Development Kit - Opticks 4.9.0 Build 16218