From d374a8274e02bba467bd8894be8cd081601f65fc Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 3 Sep 2013 19:06:06 +0100 Subject: [PATCH 12/13] McdConnectivityMonitor: comment how McdInhibit works Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68758 --- src/connectivity-monitor.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/connectivity-monitor.c b/src/connectivity-monitor.c index d0211e0..4484f98 100644 --- a/src/connectivity-monitor.c +++ b/src/connectivity-monitor.c @@ -51,7 +51,20 @@ #define LOGIN1_MANAGER_INHIBIT "Inhibit" struct _McdInhibit { + /* The number of reasons why we should delay sleep/shutdown. This behaves + * like a refcount: when it reaches 0, we close the fd and free the + * McdInhibit structure. + * + * 1 when we are waiting for PrepareForSleep/PrepareForShutdown; + * the number of extra "holds" (currently one per McdAccount) when we have + * received that signal and are waiting for each McdAccount to disconnect; + * temporarily 1 + number of extra "holds" while we are dealing with the + * signal. + */ gsize holds; + + /* fd encapsulating the delay, provided by logind. We close this + * when we no longer have any reason to delay sleep/shutdown. */ int fd; }; -- 1.8.4.rc3