diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/job_manager.cc | 15 | ||||
| -rw-r--r-- | src/lib/job_manager.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/job_manager.cc b/src/lib/job_manager.cc index e3b6e257b..6d651d2ba 100644 --- a/src/lib/job_manager.cc +++ b/src/lib/job_manager.cc @@ -90,6 +90,21 @@ JobManager::add (shared_ptr<Job> j) return j; } +shared_ptr<Job> +JobManager::add_after (shared_ptr<Job> after, shared_ptr<Job> j) +{ + { + boost::mutex::scoped_lock lm (_mutex); + list<shared_ptr<Job> >::iterator i = find (_jobs.begin(), _jobs.end(), after); + DCPOMATIC_ASSERT (i != _jobs.end()); + _jobs.insert (i, j); + } + + emit (boost::bind (boost::ref (JobAdded), weak_ptr<Job> (j))); + + return j; +} + list<shared_ptr<Job> > JobManager::get () const { diff --git a/src/lib/job_manager.h b/src/lib/job_manager.h index 9cba0fd09..a382dd736 100644 --- a/src/lib/job_manager.h +++ b/src/lib/job_manager.h @@ -41,6 +41,7 @@ class JobManager : public Signaller, public boost::noncopyable { public: boost::shared_ptr<Job> add (boost::shared_ptr<Job>); + boost::shared_ptr<Job> add_after (boost::shared_ptr<Job> after, boost::shared_ptr<Job> j); std::list<boost::shared_ptr<Job> > get () const; bool work_to_do () const; bool errors () const; |
