18 #ifndef itkThreadPool_h 19 #define itkThreadPool_h 21 #include "itkConfigure.h" 26 #if defined(ITK_USE_PTHREADS) 28 #include <semaphore.h> 30 #elif defined(ITK_USE_WIN32_THREADS) 35 #include <mach/mach_init.h> 36 #include <mach/mach_error.h> 37 #include <mach/semaphore.h> 38 #include <mach/task.h> 39 #include <mach/task_info.h> 97 static Pointer GetInstance();
104 void InitializeThreads(ThreadCountType maxThreads);
116 #if defined(__APPLE__) 117 semaphore_t m_Semaphore;
118 #elif defined(_WIN32) || defined(_WIN64) 120 #elif defined(ITK_USE_PTHREADS) 141 bool m_ScheduleForDestruction;
144 ThreadCountType m_ThreadCount;
150 unsigned int m_IdCounter;
153 bool m_ExceptionOccurred;
168 ThreadJobContainerType m_WorkerQueue;
174 ThreadProcessIdContainerType m_ThreadHandles;
179 JOB_THREADHANDLE_JUST_ADDED=-3,
180 JOB_THREADHANDLE_IS_FREE=-2,
182 JOB_THREADHANDLE_IS_DONE=-1
199 #if defined(ITK_USE_WIN32_THREADS) 206 const WinThreadIdType winThreadId) :
207 m_ThreadNumericId(tnid),
208 m_ThreadProcessHandle(tph),
209 m_WinThreadId(winThreadId)
250 void RemoveActiveId(ThreadJobIdType
id);
272 void DeallocateThreadSemSet(ThreadSemHandlePairingQueueType &q);
275 static void * ThreadExecute(
void *param);
std::pair< ThreadJobIdType, ThreadJob > ThreadJobContainerPairType
Critical section locking class that can be allocated on the stack.
ThreadSemHandlePairingQueueType m_ThreadSemHandlePairingForWaitQueue
std::vector< ThreadProcessIdentifiers > ThreadProcessIdentifiersVecType
This class is used to submit jobs to the thread pool. The thread job maintains important information ...
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes...
ThreadJob::JobIdType ThreadJobIdType
std::map< ThreadJobIdType, ThreadJob > ThreadJobContainerType
static SimpleFastMutexLock m_ThreadProcessIdentifiersVectorMutex
static Pointer m_ThreadPoolInstance
std::set< ThreadJobIdType > ThreadJobIdsContainerType
std::vector< ThreadSemaphorePair * > ThreadSemHandlePairingQueueType
static int m_SemaphoreCount
ThreadProcessIdType m_ThreadProcessHandle
SmartPointer< const Self > ConstPointer
std::set< ThreadProcessIdType > ThreadProcessIdContainerType
unsigned long WinThreadIdType
ThreadProcessIdentifiersVecType m_ThreadProcessIdentifiersVector
ThreadProcessIdentifiers(const int tnid, const ThreadProcessIdType tph, const WinThreadIdType winThreadId)
unsigned int ThreadIdType
ThreadSemHandlePairingQueueType m_ThreadSemHandlePairingQueue
Thread pool manages the threads for itk.
unsigned int ThreadCountType
WinThreadIdType m_WinThreadId
Base class for most ITK classes.
ThreadProcessIdType m_ThreadProcessHandle
static SimpleFastMutexLock m_ThreadPoolInstanceMutex