unit: rework stop pending logic

When a trigger unit wants to know if a stop is queued for it, we should
just check precisely that and do not check whether it is actually
stopped already. This is because we use these checks usually from state
change calls where the state variables are not updated yet.

This change splits unit_pending_inactive() into two calls
unit_inactive_or_pending() and unit_stop_pending(). The former checks
state and pending jobs, the latter only pending jobs.
This commit is contained in:
Lennart Poettering
2013-04-25 22:01:49 -03:00
parent 67fb4482ac
commit 31afa0a44c
9 changed files with 32 additions and 22 deletions
+1 -1
View File
@@ -374,7 +374,7 @@ static void timer_enter_running(Timer *t) {
dbus_error_init(&error);
/* Don't start job if we are supposed to go down */
if (unit_pending_inactive(UNIT(t)))
if (unit_stop_pending(UNIT(t)))
return;
r = manager_add_job(UNIT(t)->manager, JOB_START, UNIT_TRIGGER(UNIT(t)),