1 #ifndef theplu_yat_utility_scheduler
2 #define theplu_yat_utility_scheduler
25 #include "PriorityQueue.h"
28 #include <boost/exception_ptr.hpp>
29 #include <boost/thread.hpp>
30 #include <boost/shared_ptr.hpp>
95 explicit Job(
unsigned int prio=0);
114 std::set<boost::shared_ptr<Job> > prerequisite_;
116 std::vector<boost::shared_ptr<Job> > observers_;
117 enum status { pristine, prepared, running, completed};
121 boost::exception_ptr error_;
138 boost::shared_ptr<Job> prerequisite);
153 void submit(boost::shared_ptr<Job> job);
161 typedef boost::shared_ptr<Scheduler::Job> JobPtr;
165 bool operator()(
const JobPtr& lhs,
const JobPtr& rhs)
const;
181 void operator()(
void);
191 void post_process(boost::shared_ptr<Job> job);
196 void process(boost::shared_ptr<Job> job);
199 void queue(boost::shared_ptr<Job> job);
204 Queue<JobPtr> completed_;
205 boost::thread_group workers_;
206 unsigned long int job_counter_;
Handle a number of jobs and send them to threads.
Definition: Scheduler.h:83
Job(unsigned int prio=0)
constructor
void submit(boost::shared_ptr< Job > job)
submit a job to Scheduler
virtual void operator()(void)=0
virtual ~Job(void)
destructor
Definition: Scheduler.h:89
void interrupt(void)
interrrupt all jobs
void add_dependency(boost::shared_ptr< Job > job, boost::shared_ptr< Job > prerequisite)
add a dependency rule
Scheduler(unsigned int threads)
constructor
void wait(void)
wait for all jobs to finish
unsigned int priority(void) const