job: only jobs on the runqueue can be run

This commit is contained in:
Michal Schmidt
2012-05-14 14:29:53 +02:00
parent 7c99edf85b
commit 66aa6f7fbb
+3 -4
View File
@@ -470,11 +470,10 @@ int job_run_and_invalidate(Job *j) {
assert(j);
assert(j->installed);
assert(j->type < _JOB_TYPE_MAX_IN_TRANSACTION);
assert(j->in_run_queue);
if (j->in_run_queue) {
LIST_REMOVE(Job, run_queue, j->manager->run_queue, j);
j->in_run_queue = false;
}
LIST_REMOVE(Job, run_queue, j->manager->run_queue, j);
j->in_run_queue = false;
if (j->state != JOB_WAITING)
return 0;