This file is indexed.

/usr/include/ossim/parallel/ossimJobThreadQueue.h is in libossim-dev 2.2.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#ifndef ossimJobThreadQueue_HEADER
#define ossimJobThreadQueue_HEADER
#include <ossim/parallel/ossimJobQueue.h>
#include <ossim/base/Thread.h>
#include <mutex>

/**
* ossimJobThreadQueue allows one to instantiate a thread with a shared
* queue. the thread will block if the queue is empty and will continue
* to pop jobs off the queue calling the start method on the job.  Once it
* finishes the job it is disguarded and then the next job will be popped off the 
* queue.
*  
* @code
* class TestJob : public ossimJob
* {
* public:
*    TestJob(){}
* protected:
*    virtual void run()
*    {
*       ossim::Thread::sleepInSeconds(2);
*    }
* };
* class MyCallback : public ossimJobCallback
* {
* public:
*    MyCallback(){}
*    virtual void started(std::shared_ptr<ossimJob> job)  
*    {
*       std::cout << "Started job\n";
*       ossimJobCallback::started(job);
*    }
*    virtual void finished(std::shared_ptr<ossimJob> job) 
*    {
*       std::cout << "Finished job\n";
*       ossimJobCallback::finished(job);
*    }
* };
* int main(int argc, char *argv[])
* {
*    std::shared_ptr<ossimJobQueue> jobQueue = std::make_shared<ossimJobQueue>();
*    std::shared_ptr<ossimJobThreadQueue> jobThreadQueue = std::make_shared<ossimJobThreadQueue>(jobQueue);
*    jobThreadQueue->start();
*    std::shared_ptr<TestJob> job = std::make_shared<TestJob>();
*    job->setCallback(std::make_shared<MyCallback>());
*    jobQueue->add(job);
*    std::cout << "Waiting 5 seconds before terminating\n";
*    ossim::Thread::sleepInSeconds(5);
*    jobThreadQueue->cancel();
*    jobThreadQueue->waitForCompletion();
* 
*    return 0;
* }
* @endcode
*/
class OSSIM_DLL ossimJobThreadQueue : public ossim::Thread
{
public:
   /**
   * constructor that allows one to instantiat the thread with 
   * a shared job queue.
   *
   * @param jqueue shared job queue
   */
   ossimJobThreadQueue(std::shared_ptr<ossimJobQueue> jqueue=0);
   
   /**
   * destructor.  Will terminate the thread and stop current jobs
   */
   virtual ~ossimJobThreadQueue();

   /**
   *
   * Sets the shared queue that this thread will be pulling jobs from
   *
   * @param jqueue the shared job queue to set
   */
   void setJobQueue(std::shared_ptr<ossimJobQueue> jqueue);
   
   /**
   * @return the current shared job queue
   */
   std::shared_ptr<ossimJobQueue> getJobQueue();
   
   /**
   * @return the current shared job queue
   */
   const std::shared_ptr<ossimJobQueue> getJobQueue() const; 
   
   /**
   * @return the current job that is being handled.
   */
   std::shared_ptr<ossimJob> currentJob();
   
   /**
   * Will cancel the current job
   */
   void cancelCurrentJob();

   /**
   * @return is the queue valid
   */
   bool isValidQueue()const;
   
   /**
   * This is method is overriden from the base thread class and is
   * the main entry point of the thread
   */
   virtual void run();
   
   /**
   * Sets the done flag.
   *
   * @param done the value to set
   */
   void setDone(bool done);
   
   /**
   * @return if the done flag is set
   */
   bool isDone()const;

   /**
   * Cancels the thread
   */
   virtual void cancel();

   /**
   * @return true if the queue is empty
   *         false otherwise.
   */
   bool isEmpty()const;
   
   /**
   * @return true if a job is currently being processed
   *         false otherwise.
   */
   bool isProcessingJob()const;
   
   /**
   * @return true if there are still jobs to be processed
   *         false otherwise.
   */
   bool hasJobsToProcess()const;
   
protected:
   /**
   * Internal method.  If setJobQueue is set on this thread
   * it will auto start this thread.
   */
   void startThreadForQueue();

   /**
   * Will return the next job on the queue
   */
   virtual std::shared_ptr<ossimJob> nextJob();
   
   bool                           m_doneFlag;
   mutable std::mutex             m_threadMutex;
   std::shared_ptr<ossimJobQueue> m_jobQueue;
   std::shared_ptr<ossimJob>      m_currentJob;
   
};

#endif