summaryrefslogtreecommitdiff
path: root/src/login/logind.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-04-11 18:44:51 +0200
committerDaniel Mack <daniel@zonque.org>2015-04-24 17:48:12 +0200
commitc0f32805086ff65d2905b0e3a9166d9ed6c2bc41 (patch)
tree25490b615512e26dd9b941d309a4ff232b3da14a /src/login/logind.c
parent3f61a7a6eb5ff7e5a14cd322897741969df6b723 (diff)
logind: use sd_event timer source for inhibitor logic
Instead of open-coding the delayed action and inhibit timeout logic, switch over to a real sd_event_source based implementation. This is not only easier to read but also allows us to add more timers in the future.
Diffstat (limited to 'src/login/logind.c')
-rw-r--r--src/login/logind.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/login/logind.c b/src/login/logind.c
index 707d528fbb..ea7c6e74b0 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -141,6 +141,7 @@ void manager_free(Manager *m) {
set_free_free(m->busnames);
sd_event_source_unref(m->idle_action_event_source);
+ sd_event_source_unref(m->inhibit_timeout_source);
sd_event_source_unref(m->console_active_event_source);
sd_event_source_unref(m->udev_seat_event_source);
@@ -1093,8 +1094,6 @@ int manager_run(Manager *m) {
assert(m);
for (;;) {
- usec_t us = (uint64_t) -1;
-
r = sd_event_get_state(m->event);
if (r < 0)
return r;
@@ -1103,19 +1102,7 @@ int manager_run(Manager *m) {
manager_gc(m, true);
- if (manager_dispatch_delayed(m) > 0)
- continue;
-
- if (m->action_what != 0 && !m->action_job) {
- usec_t x, y;
-
- x = now(CLOCK_MONOTONIC);
- y = m->action_timestamp + m->inhibit_delay_max;
-
- us = x >= y ? 0 : y - x;
- }
-
- r = sd_event_run(m->event, us);
+ r = sd_event_run(m->event, (uint64_t) -1);
if (r < 0)
return r;
}