From 314b4b0a68d9ab35de981923a088fc8c8820caa5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 25 Jan 2013 06:30:23 +0100 Subject: logind: rework delay inhibition logic - Don't allow any locks to be taken while we are in the process of executing the specific operation, so that apps are not surprised if a suspend/shutdown happens while they rely on their inhibitor. - Get rid of the Resumed signal, it was a bad idea, and redundant due to PrepareForSleep(false), see below. - Always send out PrepareFor{Shutdown,Sleep} signals, instead of only if a delay lock is taken. - Move PrepareForSleep(false) after we come back from the suspend, so that apps can use this as "Resumed" notification. This also has the benefit that apps know when to take a new lock. --- src/login/logind.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/login/logind.h') diff --git a/src/login/logind.h b/src/login/logind.h index 7a0f8f25b0..904dc20467 100644 --- a/src/login/logind.h +++ b/src/login/logind.h @@ -91,17 +91,21 @@ struct Manager { Hashmap *inhibitor_fds; Hashmap *button_fds; - /* If a shutdown was delayed due to a inhibitor this contains - the unit name we are supposed to start after the delay is - over */ - const char *delayed_unit; - InhibitWhat delayed_what; - usec_t delayed_timestamp; - usec_t inhibit_delay_max; - char* action_job; - bool send_resumed_after_action_job; + /* If an action is currently being executed or is delayed, + * this is != 0 and encodes what is being done */ + InhibitWhat action_what; + + /* If a shutdown/suspend was delayed due to a inhibitor this + contains the unit name we are supposed to start after the + delay is over */ + const char *action_unit; + + /* If a shutdown/suspend is currently executed, then this is + * the job of it */ + char *action_job; + usec_t action_timestamp; int idle_action_fd; /* the timer_fd */ usec_t idle_action_usec; -- cgit v1.2.3-54-g00ecf