X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fjob_manager.h;h=f0673df1531bd933d0ebb6662795e20e18cc9a84;hb=5e4f001bf32e3cdf65efa34803d70e6c1c00c66b;hp=f2f5e0057c946c6bc02e767bc755252d7f5adb2e;hpb=bb767c7e338414beee132af3e96829c1448e214b;p=dcpomatic.git diff --git a/src/lib/job_manager.h b/src/lib/job_manager.h index f2f5e0057..f0673df15 100644 --- a/src/lib/job_manager.h +++ b/src/lib/job_manager.h @@ -23,32 +23,44 @@ #include #include +#include +#include class Job; +extern void wait_for_jobs (); /** @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); + 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 (); + static void drop (); private: + /* This function is part of the test suite */ + friend void ::wait_for_jobs (); + JobManager (); + ~JobManager (); void scheduler (); mutable boost::mutex _mutex; std::list > _jobs; + bool _terminate; + + bool _last_active_jobs; + boost::thread* _scheduler; static JobManager* _instance; };