chiark / gitweb /
core: dispatch run queue only if there's nothing else to do
[elogind.git] / src / core / job.c
index f791299a9d640755379435a222fa78f6a9d48862..9cd6ce24b8ff13d86ed8cfa086f7f31af2f8ffce 100644 (file)
@@ -874,6 +874,9 @@ void job_add_to_run_queue(Job *j) {
         if (j->in_run_queue)
                 return;
 
+        if (!j->manager->run_queue)
+                sd_event_source_set_enabled(j->manager->run_queue_event_source, SD_EVENT_ONESHOT);
+
         LIST_PREPEND(run_queue, j->manager->run_queue, j);
         j->in_run_queue = true;
 }