X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fjob_manager.cc;h=5504251b00faa073a2be36747294400091e96209;hb=e64cc1c9f007a2654c6f6cba7110584ed460da05;hp=7a6bda8405b32240ae18bd9211e65abfe228a060;hpb=0de66f5453b996003aa7f739815888d0b2a98b50;p=dcpomatic.git diff --git a/src/lib/job_manager.cc b/src/lib/job_manager.cc index 7a6bda840..5504251b0 100644 --- a/src/lib/job_manager.cc +++ b/src/lib/job_manager.cc @@ -75,7 +75,7 @@ JobManager::~JobManager () { boost::mutex::scoped_lock lm (_mutex); _terminate = true; - _empty_condition.notify_all (); + _schedule_condition.notify_all(); } try { @@ -90,7 +90,7 @@ JobManager::add (shared_ptr j) { boost::mutex::scoped_lock lm (_mutex); _jobs.push_back (j); - _empty_condition.notify_all (); + _schedule_condition.notify_all(); } emit (boost::bind(boost::ref(JobAdded), weak_ptr(j))); @@ -107,7 +107,7 @@ JobManager::add_after (shared_ptr after, shared_ptr j) auto i = find (_jobs.begin(), _jobs.end(), after); DCPOMATIC_ASSERT (i != _jobs.end()); _jobs.insert (i, j); - _empty_condition.notify_all (); + _schedule_condition.notify_all(); } emit (boost::bind(boost::ref(JobAdded), weak_ptr(j))); @@ -183,7 +183,7 @@ JobManager::scheduler () } } - _empty_condition.wait (lm); + _schedule_condition.wait(lm); } } @@ -197,7 +197,7 @@ JobManager::job_finished () _last_active_job = optional(); } - _empty_condition.notify_all (); + _schedule_condition.notify_all(); } @@ -250,7 +250,7 @@ JobManager::analyse_audio ( job = make_shared (film, playlist, from_zero); connection = job->Finished.connect (ready); _jobs.push_back (job); - _empty_condition.notify_all (); + _schedule_condition.notify_all (); } emit (boost::bind (boost::ref (JobAdded), weak_ptr (job))); @@ -285,7 +285,7 @@ JobManager::analyse_subtitles ( job = make_shared(film, content); connection = job->Finished.connect (ready); _jobs.push_back (job); - _empty_condition.notify_all (); + _schedule_condition.notify_all (); } emit (boost::bind(boost::ref(JobAdded), weak_ptr(job))); @@ -304,7 +304,7 @@ JobManager::increase_priority (shared_ptr job) swap(*iter, *std::prev(iter)); } - _empty_condition.notify_all(); + _schedule_condition.notify_all(); emit(boost::bind(boost::ref(JobsReordered))); } @@ -321,7 +321,7 @@ JobManager::decrease_priority (shared_ptr job) swap(*iter, *std::next(iter)); } - _empty_condition.notify_all(); + _schedule_condition.notify_all(); emit(boost::bind(boost::ref(JobsReordered))); } @@ -331,7 +331,7 @@ JobManager::pause () { boost::mutex::scoped_lock lm (_mutex); - if (_paused) { + if (_paused_job) { return; } @@ -340,8 +340,6 @@ JobManager::pause () _paused_job = i; } } - - _paused = true; } @@ -349,14 +347,11 @@ void JobManager::resume () { boost::mutex::scoped_lock lm (_mutex); - if (!_paused) { - return; - } - if (_paused_job) { - _paused_job->resume (); + if (!_paused_job) { + return; } - _paused_job.reset (); - _paused = false; + _paused_job->resume(); + _paused_job.reset(); }