From 255baef68a8d9d74cb3b846f93c290225ad162aa Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 26 Nov 2013 02:13:41 +0100 Subject: core: add new "flush" job mode to cancel all other jobs when queuing a new job --- src/core/job.c | 3 ++- src/core/job.h | 1 + src/core/transaction.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/job.c b/src/core/job.c index 9cd6ce24b8..557917a70b 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -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); diff --git a/src/core/job.h b/src/core/job.h index 3f6357a054..c23a38029d 100644 --- a/src/core/job.h +++ b/src/core/job.h @@ -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, diff --git a/src/core/transaction.c b/src/core/transaction.c index e2ff0bd1e5..36e31c45c9 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -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 */ -- cgit v1.2.3-54-g00ecf