R3DAbstractThread Class Reference

#include <R3D/Threads/R3DAbstractThread.h>

Inherited by EmMpmThread, PCMRegistrationThread, RotationRegistrationThread, and TileAlignmentThread.

Inheritance diagram for R3DAbstractThread:

Inheritance graph
[legend]
List of all members.

Detailed Description

This class serves as an abstract base class that can be used in combination with the R3DThreadGroup in order to manage threads and their associated resources in a more coherent fashion.

Subclasses of this class should implement the pure virtual method "run()" which will get called when the thread starts. After the 'run()' method has completed then the 'threadComplete()' method is called. The default action of the 'threadComplete' method is to attempt to call to the R3DThreadGroup object and set the slot that this thread is stored in as "complete". This action will allow the R3DThreadGroup object to clean up the actual boost thread object which should release all the thread resources that this object is holding onto. You can over ride the "threadComplete" method and implement something else if you wish. If you do leave out a call to the thread Group to mark this thread as being complete make sure to somehow manage the threads in the thread group or the resources will NEVER be released and eventually the program will just hang or segfault or something else bad.

Author:
Michael A. Jackson for BlueQuartz Software
Date:
Apr 6, 2009
Version:
1.0


Public Member Functions

 MXA_INSTANCE_PROPERTY (R3DThreadGroup::Pointer, ThreadGroup, _tGroup)
 Sets/Gets the R3DThreadGroup object that this thread belongs to.
 MXA_INSTANCE_PROPERTY (int32, ThreadSlot, _threadSlot)
 Sets the value of the slot in the R3DThreadGroup that holds the pointer to this thread.
 MXA_INSTANCE_STRING_PROPERTY (ThreadName, _threadName)
 Sets the name of the thread which should be unique.
 MXA_INSTANCE_PROPERTY (int32, ErrorCondition, _error)
 Sets and gets any error condition that might be noteworthy during the execution of the thread.
void operator() ()
 Mandatory method that must be implemented in order for the boost::thread class to invoke this code.
virtual void run ()=0
 Method to be impelemented in your subclass that will do the work on the thread.
virtual void threadComplete ()
 This method is called when the 'run()' method is complete.


Member Function Documentation

virtual void R3DAbstractThread::threadComplete (  )  [inline, virtual]

This method is called when the 'run()' method is complete.

The default behavior is to call the R3DThreadGroup and mark this thread as complete.


The documentation for this class was generated from the following file:
Generated on Fri Aug 28 14:04:33 2009 for R3DImageTools by  doxygen 1.5.2