X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fjob_manager.h;h=0040568c66a5958bb497b86e83e92deba10655da;hb=f98c4cdec82fc2fbdcc4ca19748d09b0ea0556b4;hp=8b79fd67d330c6078563da2f5972a8766801095c;hpb=cb33319a820b17a05cfb2ef78ba1799f4d0c54b9;p=dcpomatic.git diff --git a/src/lib/job_manager.h b/src/lib/job_manager.h index 8b79fd67d..0040568c6 100644 --- a/src/lib/job_manager.h +++ b/src/lib/job_manager.h @@ -23,34 +23,38 @@ #include #include +#include class Job; /** @class JobManager * @brief A simple scheduler for jobs. - * - * JobManager simply keeps a list of pending jobs, and assumes that all the jobs - * are sufficiently CPU intensive that there is no point running them in parallel; - * so jobs are just run one after the other. */ -class JobManager +class JobManager : public boost::noncopyable { public: - void add (boost::shared_ptr); - void add_after (boost::shared_ptr after, boost::shared_ptr j); + boost::shared_ptr add (boost::shared_ptr); std::list > get () const; bool work_to_do () const; bool errors () const; + boost::signals2::signal)> JobAdded; + boost::signals2::signal ActiveJobsChanged; + static JobManager* instance (); private: + /* This function is part of the test suite */ + friend void ::wait_for_jobs (); + JobManager (); void scheduler (); mutable boost::mutex _mutex; std::list > _jobs; + bool _last_active_jobs; + static JobManager* _instance; };