30 #ifndef CPL_WORKER_THREAD_POOL_H_INCLUDED_
31 #define CPL_WORKER_THREAD_POOL_H_INCLUDED_
33 #include "cpl_multiproc.h"
48 CPLThreadFunc pfnFunc;
54 CPLThreadFunc pfnInitFunc;
57 CPLJoinableThread *hThread;
70 } CPLWorkerThreadState;
74 std::vector<CPLWorkerThread> aWT;
77 volatile CPLWorkerThreadState eState;
79 volatile int nPendingJobs;
81 CPLList* psWaitingWorkerThreadsList;
82 int nWaitingWorkerThreads;
84 static void WorkerThreadFunction(
void* user_data);
86 void DeclareJobFinished();
93 bool Setup(
int nThreads,
94 CPLThreadFunc pfnInitFunc,
96 bool SubmitJob(CPLThreadFunc pfnFunc,
void* pData);
97 bool SubmitJobs(CPLThreadFunc pfnFunc,
const std::vector<void*>& apData);
98 void WaitCompletion(
int nMaxRemainingJobs = 0);
100 int GetThreadCount()
const {
return (
int)aWT.size(); }
103 #endif // CPL_WORKER_THREAD_POOL_H_INCLUDED_
List element structure.
Definition: cpl_list.h:48
Definition: cpl_worker_thread_pool.h:52
Simplest list implementation.
Definition: cpl_worker_thread_pool.h:72
Definition: cpl_worker_thread_pool.h:46