, _last_active_jobs (false)
, _scheduler (new boost::thread (boost::bind (&JobManager::scheduler, this)))
{
-
+
}
JobManager::~JobManager ()
}
emit (boost::bind (boost::ref (JobAdded), weak_ptr<Job> (j)));
-
+
return j;
}
}
return false;
-}
+}
void
JobManager::scheduler ()
if (_terminate) {
return;
}
-
+
for (list<shared_ptr<Job> >::iterator i = _jobs.begin(); i != _jobs.end(); ++i) {
if (!(*i)->finished ()) {
active_jobs = true;
}
-
+
if ((*i)->running ()) {
/* Something is already happening */
break;
}
-
+
if ((*i)->is_new()) {
(*i)->start ();
-
+
/* Only start one job at once */
break;
}