Speed up response to a request to pause a job.
[dcpomatic.git] / src / lib / job.h
index a6777bc449e4a805c3db74d72c6c9d25938bba8e..660ddaa132715dc7e4f4dba1cb647344492de441 100644 (file)
@@ -65,7 +65,6 @@ public:
        std::string error_summary () const;
        std::string error_details () const;
 
-       int elapsed_time () const;
        virtual std::string status () const;
        std::string json_status () const;
        std::string sub_name () const {
@@ -103,6 +102,8 @@ protected:
 
        void set_state (State);
        void set_error (std::string s, std::string d);
+       int elapsed_sub_time () const;
+       void check_for_interruption_or_pause ();
 
        boost::shared_ptr<const Film> _film;
 
@@ -121,13 +122,16 @@ private:
        std::string _error_summary;
        std::string _error_details;
 
-       /** time that this sub-job was started */
+       /** time that this job was started */
        time_t _start_time;
+       /** time that this sub-job was started */
+       time_t _sub_start_time;
        std::string _sub_name;
 
-       /** mutex for _progress */
+       /** mutex for _progress and _last_progress_update */
        mutable boost::mutex _progress_mutex;
        boost::optional<float> _progress;
+       boost::optional<struct timeval> _last_progress_update;
 
        /** condition to signal changes to pause/resume so that we know when to wake;
            this could be a general _state_change if it made more sense.