25#ifndef vtkMultiThreader_h
26#define vtkMultiThreader_h
28#include "vtkCommonCoreModule.h"
30#include "vtkThreads.h"
34#if defined(VTK_USE_PTHREADS)
52#ifdef VTK_USE_PTHREADS
53typedef void* (*vtkThreadFunctionType)(
void*);
60#ifdef VTK_USE_WIN32_THREADS
68#if !defined(VTK_USE_PTHREADS) && !defined(VTK_USE_WIN32_THREADS)
112 vtkSetClampMacro(NumberOfThreads,
int, 1, VTK_MAX_THREADS);
220 int SpawnedThreadActiveFlag[VTK_MAX_THREADS];
221 std::mutex* SpawnedThreadActiveFlagLock[VTK_MAX_THREADS];
227 void* MultipleData[VTK_MAX_THREADS];
a simple class to control print indentation
This is the structure that is passed to the thread that is created from the SingleMethodExecute,...
std::mutex * ActiveFlagLock
A class for performing multithreaded execution.
static void SetGlobalDefaultNumberOfThreads(int val)
Set/Get the value which is used to initialize the NumberOfThreads in the constructor.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static int GetGlobalMaximumNumberOfThreads()
Set/Get the maximum number of threads to use when multithreading.
int SpawnThread(vtkThreadFunctionType, void *data)
Create a new thread for the given function.
vtkThreadFunctionType SingleMethod
~vtkMultiThreader() override
static void SetGlobalMaximumNumberOfThreads(int val)
Set/Get the maximum number of threads to use when multithreading.
void SetSingleMethod(vtkThreadFunctionType, void *data)
Set the SingleMethod to f() and the UserData field of the ThreadInfo that is passed to it will be dat...
void SingleMethodExecute()
Execute the SingleMethod (as define by SetSingleMethod) using this->NumberOfThreads threads.
static vtkTypeBool ThreadsEqual(vtkMultiThreaderIDType t1, vtkMultiThreaderIDType t2)
Check whether two thread identifiers refer to the same thread.
void SetMultipleMethod(int index, vtkThreadFunctionType, void *data)
Set the MultipleMethod at the given index to f() and the UserData field of the ThreadInfo that is pas...
static int GetGlobalStaticMaximumNumberOfThreads()
Set/Get the maximum number of threads VTK was allocated to support.
void MultipleMethodExecute()
Execute the MultipleMethods (as define by calling SetMultipleMethod for each of the required this->Nu...
vtkTypeBool IsThreadActive(int threadId)
Determine if a thread is still active.
void TerminateThread(int threadId)
Terminate the thread that was created with a SpawnThreadExecute()
static vtkMultiThreader * New()
static vtkMultiThreaderIDType GetCurrentThreadID()
Get the thread identifier of the calling thread.
static int GetGlobalDefaultNumberOfThreads()
Set/Get the value which is used to initialize the NumberOfThreads in the constructor.
virtual int GetNumberOfThreads()
Get/Set the number of threads to create.
abstract base class for most VTK objects
int vtkMultiThreaderIDType
int vtkThreadProcessIDType
void(* vtkThreadFunctionType)(void *)