28 #ifndef itkMultiThreader_h
29 #define itkMultiThreader_h
52 class ITKCommon_EXPORT MultiThreader :
public Object
56 typedef MultiThreader Self;
57 typedef Object Superclass;
58 typedef SmartPointer<Self> Pointer;
59 typedef SmartPointer<const Self> ConstPointer;
65 itkTypeMacro(MultiThreader, Object);
79 static void SetGlobalMaximumNumberOfThreads(
ThreadIdType val);
87 static void SetGlobalDefaultUseThreadPool(
const bool GlobalDefaultUseThreadPool );
88 static bool GetGlobalDefaultUseThreadPool( );
95 static void SetGlobalDefaultNumberOfThreads(
ThreadIdType val);
103 void SingleMethodExecute();
109 void MultipleMethodExecute();
133 itkSetObjectMacro(ThreadPool, ThreadPool);
136 itkGetModifiableObjectMacro(ThreadPool, ThreadPool);
141 itkSetMacro(UseThreadPool,
bool);
144 itkGetMacro(UseThreadPool,
bool);
159 #ifdef ThreadInfoStruct
160 #undef ThreadInfoStruct
162 struct ThreadInfoStruct
170 JobSemaphoreType Semaphore;
171 enum { SUCCESS, ITK_EXCEPTION, ITK_PROCESS_ABORTED_EXCEPTION, STD_EXCEPTION, UNKNOWN } ThreadExitCode;
176 ~MultiThreader() ITK_OVERRIDE;
177 virtual
void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
180 ITK_DISALLOW_COPY_AND_ASSIGN(MultiThreader);
183 ThreadPool::Pointer m_ThreadPool;
186 bool m_UseThreadPool;
199 int m_SpawnedThreadActiveFlag[ITK_MAX_THREADS];
200 MutexLock::Pointer m_SpawnedThreadActiveFlagLock[ITK_MAX_THREADS];
202 ThreadInfoStruct m_SpawnedThreadInfoArray[ITK_MAX_THREADS];
206 void *m_MultipleData[ITK_MAX_THREADS];
217 static
bool m_GlobalDefaultUseThreadPool;
247 void ThreadPoolDispatchSingleMethodThread(ThreadInfoStruct *);
void(* ThreadFunctionType)(void *)
#define ITK_THREAD_RETURN_TYPE
unsigned int ThreadIdType
ThreadJob::Semaphore Semaphore
SmartPointer< Self > Pointer