+ emit (boost::bind(boost::ref(JobAdded), weak_ptr<Job>(job)));
+}
+
+
+void
+JobManager::increase_priority (shared_ptr<Job> job)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ auto iter = std::find(_jobs.begin(), _jobs.end(), job);
+ if (iter == _jobs.begin() || iter == _jobs.end()) {
+ return;
+ }
+ swap(*iter, *std::prev(iter));
+ }
+
+ _schedule_condition.notify_all();
+ emit(boost::bind(boost::ref(JobsReordered)));
+}
+
+
+void
+JobManager::decrease_priority (shared_ptr<Job> job)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ auto iter = std::find(_jobs.begin(), _jobs.end(), job);
+ if (iter == _jobs.end() || std::next(iter) == _jobs.end()) {
+ return;
+ }
+ swap(*iter, *std::next(iter));
+ }
+
+ _schedule_condition.notify_all();
+ emit(boost::bind(boost::ref(JobsReordered)));
+}
+
+
+/** Pause all job processing */
+void
+JobManager::pause ()
+{
+ boost::mutex::scoped_lock lm (_mutex);
+ _paused = true;
+ _schedule_condition.notify_all();
+}
+
+
+/** Resume processing jobs after a previous pause() */
+void
+JobManager::resume ()
+{
+ boost::mutex::scoped_lock lm (_mutex);
+ _paused = false;
+ _schedule_condition.notify_all();