Factor out key-value code.
[dcpomatic.git] / src / lib / job.cc
index 39ce4173a78a8af19621e5f4f31f95a946ea170c..d3871bf7225da22ed1911416c1b2ee4df4cffd5d 100644 (file)
@@ -34,10 +34,11 @@ using namespace boost;
  *  @param o Options.
  *  @param l A log that we can write to.
  */
-Job::Job (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l)
+Job::Job (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l, shared_ptr<Job> req)
        : _fs (s)
        , _opt (o)
        , _log (l)
+       , _required (req)
        , _state (NEW)
        , _start_time (0)
        , _progress_unknown (false)
@@ -80,6 +81,13 @@ Job::run_wrapper ()
        }
 }
 
+bool
+Job::is_new () const
+{
+       boost::mutex::scoped_lock lm (_state_mutex);
+       return _state == NEW;
+}
+
 /** @return true if the job is running */
 bool
 Job::running () const