This allows us to consolidate the knowledge of how a job sorts
based on priority.
return (jpp ? *jpp : (Job*) NULL);
}
+bool
+Job::higherPriority (const Job& other) const
+{
+ if (pri < other.pri)
+ return true;
+ if (pri == other.pri && tts <= other.tts)
+ return true;
+ return false;
+}
+
void
Job::startKillTimer(long sec)
{
static Job* getJobByID(const fxStr& jobid);
static fxStr jobStatusName(const JobStatus);
+ bool higherPriority(const Job& other) const;
+
void startKillTimer(long sec);
void stopKillTimer();
traceJob(job, "READY");
Trigger::post(Trigger::JOB_READY, job);
JobIter iter(runqs[JOBHASH(job.pri)]);
- for (; iter.notDone() && (iter.job().pri < job.pri ||
- (iter.job().pri == job.pri && iter.job().tts <= job.tts)); iter++)
- ;
+ for (; iter.notDone(); iter++)
+ if (! iter.job().higherPriority(job))
+ break;
job.insert(iter.job());
/*
* In order to deliberately batch jobs by using a common