telepathy-mission-control: McdConnectivityMonitor: comment how McdInhibit works

Simon McVittie smcv at kemper.freedesktop.org
Wed Sep 4 05:38:36 PDT 2013


Module: telepathy-mission-control
Branch: master
Commit: 425a6cb46cabf35bde272f99c5b8260b29a70201
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=425a6cb46cabf35bde272f99c5b8260b29a70201

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Sep  3 19:06:06 2013 +0100

McdConnectivityMonitor: comment how McdInhibit works

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68758
Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>

---

 src/connectivity-monitor.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

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;
 };
 



More information about the telepathy-commits mailing list