chiark / gitweb /
core: add new "flush" job mode to cancel all other jobs when queuing a new job
authorLennart Poettering <lennart@poettering.net>
Tue, 26 Nov 2013 01:13:41 +0000 (02:13 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 26 Nov 2013 01:26:31 +0000 (02:26 +0100)
src/core/job.c
src/core/job.h
src/core/transaction.c

index 9cd6ce24b8ff13d86ed8cfa086f7f31af2f8ffce..557917a70b0dce3e42ce08ac594acfc91376fdd5 100644 (file)
@@ -1107,7 +1107,8 @@ static const char* const job_mode_table[_JOB_MODE_MAX] = {
         [JOB_REPLACE_IRREVERSIBLY] = "replace-irreversibly",
         [JOB_ISOLATE] = "isolate",
         [JOB_IGNORE_DEPENDENCIES] = "ignore-dependencies",
-        [JOB_IGNORE_REQUIREMENTS] = "ignore-requirements"
+        [JOB_IGNORE_REQUIREMENTS] = "ignore-requirements",
+        [JOB_FLUSH] = "flush",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(job_mode, JobMode);
index 3f6357a054dc1cedfaaa22c106f571ad72b2c919..c23a38029d3932c23e1edf5426b10782f0c5d473 100644 (file)
@@ -84,6 +84,7 @@ enum JobMode {
         JOB_REPLACE,             /* Replace an existing conflicting job */
         JOB_REPLACE_IRREVERSIBLY,/* Like JOB_REPLACE + produce irreversible jobs */
         JOB_ISOLATE,             /* Start a unit, and stop all others */
+        JOB_FLUSH,               /* Flush out all other queued jobs when queing this one */
         JOB_IGNORE_DEPENDENCIES, /* Ignore both requirement and ordering dependencies */
         JOB_IGNORE_REQUIREMENTS, /* Ignore requirement dependencies */
         _JOB_MODE_MAX,
index e2ff0bd1e5986fe0af05d4c9b0eeb06fe9150103..36e31c45c9949dc5a5a82b981ff31490242c24cb 100644 (file)
@@ -578,7 +578,7 @@ static int transaction_apply(Transaction *tr, Manager *m, JobMode mode) {
 
         /* Moves the transaction jobs to the set of active jobs */
 
-        if (mode == JOB_ISOLATE) {
+        if (mode == JOB_ISOLATE || mode == JOB_FLUSH) {
 
                 /* When isolating first kill all installed jobs which
                  * aren't part of the new transaction */