summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Kozina <okozina@redhat.com>2015-03-09 15:39:22 +0100
committerOndrej Kozina <okozina@redhat.com>2015-04-01 11:01:22 +0200
commit481a8ca354809d1e8a96cf09886cc35dc702e954 (patch)
tree9ea9ce47f5f6af5c1b170ada5203585746e7cb98
parentdcbe0441386597acc8810b379be87e6cff50c4a2 (diff)
downloadlvm2-481a8ca354809d1e8a96cf09886cc35dc702e954.tar.gz
libdaemon: add comments for timeout support
-rw-r--r--libdaemon/server/daemon-server.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/libdaemon/server/daemon-server.h b/libdaemon/server/daemon-server.h
index e6839c9d6..fd62c86de 100644
--- a/libdaemon/server/daemon-server.h
+++ b/libdaemon/server/daemon-server.h
@@ -37,6 +37,13 @@ typedef struct {
struct timeval;
+/*
+ * is_idle: daemon implementation sets it to true when no background task
+ * is running
+ * max_timeouts: how many seconds do daemon allow to be idle before it shutdowns
+ * ptimeout: internal variable passed to select(). has to be reset to 1 second
+ * before each select
+ */
typedef struct {
volatile unsigned is_idle;
unsigned max_timeouts;
@@ -45,7 +52,6 @@ typedef struct {
struct daemon_state;
-
/*
* Craft a simple reply, without the need to construct a config_tree. See
* daemon_send_simple in daemon-client.h for the description of the parameters.
@@ -178,6 +184,7 @@ void daemon_log_enable(log_state *s, int outlet, int type, int enable);
*/
int daemon_log_parse(log_state *s, int outlet, const char *types, int enable);
+/* safely return of max_timeouts count */
static inline unsigned _get_max_timeouts(daemon_state s)
{
return s.idle ? s.idle->max_timeouts : 0;