#include <vtkThreadedController.h>
Inheritance diagram for vtkThreadedController:
Public Member Functions | |
vtkTypeRevisionMacro (vtkThreadedController, vtkMultiProcessController) | |
void | PrintSelf (ostream &os, vtkIndent indent) |
Print the state of this object. | |
virtual void | Initialize (int *argc, char ***argv, int) |
This method is for setting up the processes. | |
virtual void | Initialize (int *argc, char ***argv) |
virtual void | Finalize () |
virtual void | Finalize (int) |
vtkGetMacro (LocalProcessId, int) | |
This method returns an integer from 0 to (NumberOfProcesses-1) indicating which process we are in. | |
virtual void | SingleMethodExecute () |
Execute the SingleMethod (as define by SetSingleMethod) using this->NumberOfProcesses processes. | |
virtual void | MultipleMethodExecute () |
Execute the MultipleMethods (as define by calling SetMultipleMethod for each of the required this->NumberOfProcesses methods) using this->NumberOfProcesses processes. | |
virtual void | Barrier () |
This method can be used to synchronize the threads. | |
virtual void | CreateOutputWindow () |
This method can be used to tell the controller to create a special output window in which all messages are preceded by the process id. | |
Static Public Member Functions | |
static vtkThreadedController * | New () |
Instantiate a new object of this type. | |
Protected Types | |
typedef pthread_t | ThreadIdType |
Protected Member Functions | |
vtkThreadedController () | |
Ctor. | |
~vtkThreadedController () | |
Dtor. | |
void | CreateProcessControllers () |
void | Start (int threadIdx) |
First method called after threads are spawned. | |
void | ResetControllers () |
vtkMultiProcessController * | GetLocalController () |
For static GetGlobalController. | |
Static Protected Member Functions | |
static VTK_THREAD_RETURN_TYPE | vtkThreadedControllerStart (void *arg) |
static void | WaitForPreviousBarrierToEnd () |
static void | BarrierStarted () |
static void | BarrierEnded () |
static void | SignalNextThread () |
static void | InitializeBarrier () |
static void | WaitForNextThread () |
Protected Attributes | |
vtkThreadedController ** | Controllers |
Each Process/Thread has its own controller. | |
ThreadIdType | ThreadId |
int | LastNumberOfProcesses |
vtkMultiThreader * | MultiThreader |
int | MultipleMethodFlag |
Used internally to switch between multiple and single method execution. | |
Static Protected Attributes | |
static vtkSimpleCriticalSection | CounterLock |
Used in barrier. | |
static int | Counter |
static int | IsBarrierInProgress |
static vtkSimpleCriticalSection * | BarrierLock |
static vtkSimpleCriticalSection * | BarrierInProgress |
The communication is accomplished using a vtkSharedMemoryCommunicator. The RMI communicator is identical to the user communicator. Note that each thread gets its own vtkThreadedController to accomplish thread safety.
Definition at line 50 of file vtkThreadedController.h.
typedef pthread_t vtkThreadedController::ThreadIdType [protected] |
Definition at line 150 of file vtkThreadedController.h.
vtkThreadedController::vtkThreadedController | ( | ) | [protected] |
Ctor.
vtkThreadedController::~vtkThreadedController | ( | ) | [protected] |
Dtor.
static vtkThreadedController* vtkThreadedController::New | ( | ) | [static] |
Instantiate a new object of this type.
This is the only method that objects of this type may be created.
Reimplemented from vtkObject.
vtkThreadedController::vtkTypeRevisionMacro | ( | vtkThreadedController | , | |
vtkMultiProcessController | ||||
) |
void vtkThreadedController::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
Print the state of this object.
os | The output stream. | |
indent | The indentation level. Used for formating output. |
Reimplemented from vtkMultiProcessController.
virtual void vtkThreadedController::Initialize | ( | int * | argc, | |
char *** | argv, | |||
int | ||||
) | [inline, virtual] |
This method is for setting up the processes.
Definition at line 75 of file vtkThreadedController.h.
References vtkMultiProcessController::Initialize().
virtual void vtkThreadedController::Initialize | ( | int * | argc, | |
char *** | argv | |||
) | [virtual] |
virtual void vtkThreadedController::Finalize | ( | ) | [virtual] |
Implements vtkMultiProcessController.
virtual void vtkThreadedController::Finalize | ( | int | ) | [inline, virtual] |
Implements vtkMultiProcessController.
Definition at line 79 of file vtkThreadedController.h.
References vtkMultiProcessController::Finalize().
vtkThreadedController::vtkGetMacro | ( | LocalProcessId | , | |
int | ||||
) |
This method returns an integer from 0 to (NumberOfProcesses-1) indicating which process we are in.
Note: The correct controller is passed as an argument to the initial function (SingleMethod/MultipleMethod). Calling this method on another controller may give wrong results.
virtual void vtkThreadedController::SingleMethodExecute | ( | ) | [virtual] |
Execute the SingleMethod (as define by SetSingleMethod) using this->NumberOfProcesses processes.
This will only return when all the processes finish executing their methods.
Implements vtkMultiProcessController.
virtual void vtkThreadedController::MultipleMethodExecute | ( | ) | [virtual] |
Execute the MultipleMethods (as define by calling SetMultipleMethod for each of the required this->NumberOfProcesses methods) using this->NumberOfProcesses processes.
Implements vtkMultiProcessController.
virtual void vtkThreadedController::Barrier | ( | ) | [virtual] |
virtual void vtkThreadedController::CreateOutputWindow | ( | ) | [virtual] |
This method can be used to tell the controller to create a special output window in which all messages are preceded by the process id.
Implements vtkMultiProcessController.
void vtkThreadedController::CreateProcessControllers | ( | ) | [protected] |
void vtkThreadedController::Start | ( | int | threadIdx | ) | [protected] |
First method called after threads are spawned.
threadIdx | The thread number to start. |
void vtkThreadedController::ResetControllers | ( | ) | [protected] |
static VTK_THREAD_RETURN_TYPE vtkThreadedController::vtkThreadedControllerStart | ( | void * | arg | ) | [static, protected] |
static void vtkThreadedController::WaitForPreviousBarrierToEnd | ( | ) | [static, protected] |
static void vtkThreadedController::BarrierStarted | ( | ) | [static, protected] |
static void vtkThreadedController::BarrierEnded | ( | ) | [static, protected] |
static void vtkThreadedController::SignalNextThread | ( | ) | [static, protected] |
static void vtkThreadedController::InitializeBarrier | ( | ) | [static, protected] |
static void vtkThreadedController::WaitForNextThread | ( | ) | [static, protected] |
vtkMultiProcessController* vtkThreadedController::GetLocalController | ( | ) | [protected, virtual] |
For static GetGlobalController.
Translates controller for thread0 to controller for local thread.
Reimplemented from vtkMultiProcessController.
vtkThreadedController** vtkThreadedController::Controllers [protected] |
vtkSimpleCriticalSection vtkThreadedController::CounterLock [static, protected] |
int vtkThreadedController::Counter [static, protected] |
Definition at line 165 of file vtkThreadedController.h.
int vtkThreadedController::IsBarrierInProgress [static, protected] |
Definition at line 166 of file vtkThreadedController.h.
vtkSimpleCriticalSection* vtkThreadedController::BarrierLock [static, protected] |
Definition at line 177 of file vtkThreadedController.h.
vtkSimpleCriticalSection* vtkThreadedController::BarrierInProgress [static, protected] |
Definition at line 178 of file vtkThreadedController.h.
ThreadIdType vtkThreadedController::ThreadId [protected] |
Definition at line 181 of file vtkThreadedController.h.
int vtkThreadedController::LastNumberOfProcesses [protected] |
Definition at line 183 of file vtkThreadedController.h.
vtkMultiThreader* vtkThreadedController::MultiThreader [protected] |
Definition at line 185 of file vtkThreadedController.h.
int vtkThreadedController::MultipleMethodFlag [protected] |
Used internally to switch between multiple and single method execution.
Definition at line 190 of file vtkThreadedController.h.