19 std::lock_guard<std::mutex> lock(
m_mutex);
24 std::lock_guard<std::mutex> lock(
m_mutex);
29 std::lock_guard<std::mutex> lock(
m_mutex);
39 std::lock_guard<std::mutex> lock(
m_mutex);
43 if(nThreads > queueSize)
45 for(idx = queueSize; idx < nThreads;++idx)
47 std::shared_ptr<ossimJobThreadQueue> threadQueue = std::make_shared<ossimJobThreadQueue>();
52 else if(nThreads < queueSize)
65 std::lock_guard<std::mutex> lock(
m_mutex);
72 std::lock_guard<std::mutex> lock(
m_mutex);
75 for(idx = 0; idx < queueSize;++idx)
84 std::lock_guard<std::mutex> lock(
m_mutex);
87 for(idx = 0; idx < queueSize;++idx)
99 std::lock_guard<std::mutex> lock(
m_mutex);
102 for(idx = 0; ((idx<queueSize)&&!result);++idx)
123 thread->waitForCompletion();
ossim_uint32 getNumberOfThreads() const
std::shared_ptr< ossimJobQueue > getJobQueue()
void cancel()
Allows one to cancel all threads.
bool areAllThreadsBusy() const
void setJobQueue(std::shared_ptr< ossimJobQueue > q)
set the job queue to all threads
void waitForCompletion()
Allows on to wait for all thread completions.
unsigned int ossim_uint32
void setNumberOfThreads(ossim_uint32 nThreads)
Will set the number of threads.
ossimJobMultiThreadQueue(std::shared_ptr< ossimJobQueue > q=0, ossim_uint32 nThreads=0)
allows one to create a pool of threads with a shared job queue
This is the base implementation for the job queue.
virtual ~ossimJobMultiThreadQueue()
Will cancel all threads and wait for completion and clear the thread queue list.
ThreadQueueList m_threadQueueList
ossim_uint32 numberOfBusyThreads() const
std::shared_ptr< ossimJobQueue > m_jobQueue
bool hasJobsToProcess() const