19#ifndef vtkMultiThreader_h
20#define vtkMultiThreader_h
22#include "vtkCommonCoreModule.h"
24#include "vtkThreads.h"
28#if defined(VTK_USE_PTHREADS)
46#ifdef VTK_USE_PTHREADS
47typedef void* (*vtkThreadFunctionType)(
void*);
54#ifdef VTK_USE_WIN32_THREADS
62#if !defined(VTK_USE_PTHREADS) && !defined(VTK_USE_WIN32_THREADS)
70VTK_ABI_NAMESPACE_BEGIN
107 vtkSetClampMacro(NumberOfThreads,
int, 1, VTK_MAX_THREADS);
215 int SpawnedThreadActiveFlag[VTK_MAX_THREADS];
216 std::mutex* SpawnedThreadActiveFlagLock[VTK_MAX_THREADS];
222 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 *)