OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimJobMultiThreadQueue.h
Go to the documentation of this file.
1 #ifndef ossimJobMultiThreadQueue_HEADER
2 #define ossimJobMultiThreadQueue_HEADER
4 #include <mutex>
5 
70 {
71 public:
72  typedef std::vector<std::shared_ptr<ossimJobThreadQueue> > ThreadQueueList;
73 
77  ossimJobMultiThreadQueue(std::shared_ptr<ossimJobQueue> q=0,
78  ossim_uint32 nThreads=0);
83  virtual ~ossimJobMultiThreadQueue();
84 
88  std::shared_ptr<ossimJobQueue> getJobQueue();
89 
93  const std::shared_ptr<ossimJobQueue> getJobQueue()const;
94 
100  void setJobQueue(std::shared_ptr<ossimJobQueue> q);
101 
105  void setNumberOfThreads(ossim_uint32 nThreads);
106 
111 
115  ossim_uint32 numberOfBusyThreads()const;
116 
120  bool areAllThreadsBusy()const;
121 
125  bool hasJobsToProcess()const;
126 
130  void cancel();
131 
136  void waitForCompletion();
137 
138 protected:
139  mutable std::mutex m_mutex;
140  std::shared_ptr<ossimJobQueue> m_jobQueue;
142 };
143 
144 #endif
OSSIM_DLL ossim_uint32 getNumberOfThreads()
Get the number threads to use from ossimPreferences or ossim::Thread.
This allocates a thread pool used to listen on a shared job queue.
unsigned int ossim_uint32
std::vector< std::shared_ptr< ossimJobThreadQueue > > ThreadQueueList
#define OSSIM_DLL
std::shared_ptr< ossimJobQueue > m_jobQueue