Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itk::MultiThreader Class Reference

A class for performing multithreaded execution. More...

#include <itkMultiThreader.h>

Inheritance diagram for itk::MultiThreader:

Inheritance graph
[legend]
Collaboration diagram for itk::MultiThreader:

Collaboration graph
[legend]
List of all members.

Public Types

typedef MultiThreader Self
typedef Object Superclass
typedef SmartPointer< SelfPointer
typedef SmartPointer< const
Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
void SingleMethodExecute ()
void MultipleMethodExecute ()
void SetSingleMethod (ThreadFunctionType, void *data)
void SetMultipleMethod (int index, ThreadFunctionType, void *data)
int SpawnThread (ThreadFunctionType, void *data)
void TerminateThread (int thread_id)
virtual void SetNumberOfThreads (int _arg)
virtual int GetNumberOfThreads ()

Static Public Member Functions

Pointer New ()
void SetGlobalMaximumNumberOfThreads (int val)
int GetGlobalMaximumNumberOfThreads ()
void SetGlobalDefaultNumberOfThreads (int val)
int GetGlobalDefaultNumberOfThreads ()

Protected Member Functions

 MultiThreader ()
 ~MultiThreader ()
void PrintSelf (std::ostream &os, Indent indent) const

Detailed Description

A class for performing multithreaded execution.

Multithreader is a class that provides support for multithreaded execution using sproc() on an SGI, or pthread_create on any platform supporting POSIX threads. This class can be used to execute a single method on multiple threads, or to specify a method per thread.

Note
If ITK_USE_SPROC is defined, then sproc() will be used to create multiple threads on an SGI. If ITK_USE_PTHREADS is defined, then pthread_create() will be used to create multiple threads (on a sun, for example).

Definition at line 124 of file itkMultiThreader.h.


Member Typedef Documentation

typedef SmartPointer<const Self> itk::MultiThreader::ConstPointer
 

Reimplemented from itk::Object.

Definition at line 131 of file itkMultiThreader.h.

typedef SmartPointer<Self> itk::MultiThreader::Pointer
 

Reimplemented from itk::Object.

Definition at line 130 of file itkMultiThreader.h.

typedef MultiThreader itk::MultiThreader::Self
 

Standard class typedefs.

Reimplemented from itk::Object.

Definition at line 128 of file itkMultiThreader.h.

typedef Object itk::MultiThreader::Superclass
 

Reimplemented from itk::Object.

Definition at line 129 of file itkMultiThreader.h.


Constructor & Destructor Documentation

itk::MultiThreader::MultiThreader  )  [protected]
 

itk::MultiThreader::~MultiThreader  )  [protected]
 


Member Function Documentation

virtual const char* itk::MultiThreader::GetClassName  )  const [virtual]
 

Run-time type information (and related methods).

Reimplemented from itk::Object.

int itk::MultiThreader::GetGlobalDefaultNumberOfThreads  )  [static]
 

Set/Get the value which is used to initialize the NumberOfThreads in the constructor. Initially this default is set to the number of processors or 8 (which ever is less).

int itk::MultiThreader::GetGlobalMaximumNumberOfThreads  )  [static]
 

Set/Get the maximum number of threads to use when multithreading. This limits and overrides any other settings for multithreading. A value of zero indicates no limit.

virtual int itk::MultiThreader::GetNumberOfThreads  )  [virtual]
 

Get/Set the number of threads to create. It will be clamped to the range 1 - ITK_MAX_THREADS, so the caller of this method should check that the requested number of threads was accepted.

void itk::MultiThreader::MultipleMethodExecute  ) 
 

Execute the MultipleMethods (as define by calling SetMultipleMethod for each of the required m_NumberOfThreads methods) using m_NumberOfThreads threads.

Pointer itk::MultiThreader::New  )  [static]
 

Method for creation through the object factory.

Reimplemented from itk::Object.

void itk::MultiThreader::PrintSelf std::ostream &  os,
Indent  indent
const [protected, virtual]
 

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from itk::Object.

void itk::MultiThreader::SetGlobalDefaultNumberOfThreads int  val  )  [static]
 

Set/Get the value which is used to initialize the NumberOfThreads in the constructor. Initially this default is set to the number of processors or 8 (which ever is less).

Referenced by main().

void itk::MultiThreader::SetGlobalMaximumNumberOfThreads int  val  )  [static]
 

Set/Get the maximum number of threads to use when multithreading. This limits and overrides any other settings for multithreading. A value of zero indicates no limit.

void itk::MultiThreader::SetMultipleMethod int  index,
ThreadFunctionType  ,
void *  data
 

Set the MultipleMethod at the given index to f() and the UserData field of the ThreadInfoStruct that is passed to it will be data.

virtual void itk::MultiThreader::SetNumberOfThreads int  _arg  )  [virtual]
 

Get/Set the number of threads to create. It will be clamped to the range 1 - ITK_MAX_THREADS, so the caller of this method should check that the requested number of threads was accepted.

void itk::MultiThreader::SetSingleMethod ThreadFunctionType  ,
void *  data
 

Set the SingleMethod to f() and the UserData field of the ThreadInfoStruct that is passed to it will be data. This method (and all the methods passed to SetMultipleMethod) must be of type itkThreadFunctionType and must take a single argument of type void *.

void itk::MultiThreader::SingleMethodExecute  ) 
 

Execute the SingleMethod (as define by SetSingleMethod) using m_NumberOfThreads threads.

int itk::MultiThreader::SpawnThread ThreadFunctionType  ,
void *  data
 

Create a new thread for the given function. Return a thread id which is a number between 0 and ITK_MAX_THREADS - 1. This id should be used to kill the thread at a later time.

void itk::MultiThreader::TerminateThread int  thread_id  ) 
 

Terminate the thread that was created with a SpawnThreadExecute()


The documentation for this class was generated from the following file:
Generated at Sun Apr 1 03:10:31 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000