aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-base.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-09-08 14:38:45 +0200
committerMattias Andrée <maandree@operamail.com>2014-09-08 14:38:45 +0200
commit3238ac1e732a9f34762aad61ac6fc20081bc4bb3 (patch)
tree0b38acecb688750c3a119208342c75c2a0aa6037 /src/mds-base.h
parentderp, danger is volatile and atomic (diff)
downloadmds-3238ac1e732a9f34762aad61ac6fc20081bc4bb3.tar.gz
mds-3238ac1e732a9f34762aad61ac6fc20081bc4bb3.tar.bz2
mds-3238ac1e732a9f34762aad61ac6fc20081bc4bb3.tar.xz
set danger in mds-base's receive_danger
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-base.h')
-rw-r--r--src/mds-base.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mds-base.h b/src/mds-base.h
index 0b5f85a..8f62c29 100644
--- a/src/mds-base.h
+++ b/src/mds-base.h
@@ -149,6 +149,11 @@ extern volatile sig_atomic_t terminating;
*/
extern volatile sig_atomic_t reexecing;
+/**
+ * Whether the server has been signaled to free unneeded memory
+ */
+extern volatile sig_atomic_t danger;
+
/**
* The file descriptor of the socket
@@ -203,17 +208,6 @@ void signal_all(int signo); /* __attribute__((weak)) */
/**
* This function is called when a signal that
- * signals that the system is running out of memory
- * has been received
- *
- * By default this function does not do anything
- *
- * @param signo The signal that has been received
- */
-void received_danger(int signo);
-
-/**
- * This function is called when a signal that
* signals the server to re-exec has been received
*
* When this function is invoked, it should set `reexecing` and
@@ -234,6 +228,16 @@ void received_reexec(int signo); /* __attribute__((weak)) */
void received_terminate(int signo); /* __attribute__((weak)) */
/**
+ * This function is called when a signal that signals that
+ * the system is running out of memory has been received
+ *
+ * When this function is invoked, it should set `danger` to a non-zero value
+ *
+ * @param signo The signal that has been received
+ */
+void received_danger(int signo); /* __attribute__((weak)) */
+
+/**
* This function should be implemented by the actual server implementation
*
* This function will be invoked before `initialise_server` (if not re-exec:ing)