summaryrefslogtreecommitdiffstats
path: root/include/ap_mpm.h
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2011-04-25 23:21:22 +0200
committerJeff Trawick <trawick@apache.org>2011-04-25 23:21:22 +0200
commit462c69e0b533aa86d9a64fbbf8a0f2059520b126 (patch)
tree3da1ce7ff3322d2d8e08292764d1b07313e0d3b0 /include/ap_mpm.h
parentmod_ldap: Make LDAPSharedCacheSize 0 create a non-shared-memory cache per (diff)
downloadapache2-462c69e0b533aa86d9a64fbbf8a0f2059520b126.tar.xz
apache2-462c69e0b533aa86d9a64fbbf8a0f2059520b126.zip
Add child_status hook for tracking creation/termination of MPM child
processes. Add end_generation hook for notification when the last MPM child of a generation exits. end_generation is implemented completely by core using the child_status hook run by the MPM. simple and mpmt_os2 MPMs don't currently run the child_status hook, so neither hook is invoked with those MPMs. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1096609 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/ap_mpm.h')
-rw-r--r--include/ap_mpm.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/include/ap_mpm.h b/include/ap_mpm.h
index ee2c3d273f..597eafb321 100644
--- a/include/ap_mpm.h
+++ b/include/ap_mpm.h
@@ -28,6 +28,7 @@
#include "apr_thread_proc.h"
#include "httpd.h"
+#include "scoreboard.h"
#ifdef __cplusplus
extern "C" {
@@ -165,7 +166,44 @@ typedef void (ap_mpm_callback_fn_t)(void *baton);
AP_DECLARE(apr_status_t) ap_mpm_register_timed_callback(apr_time_t t,
ap_mpm_callback_fn_t *cbfn,
void *baton);
-
+
+typedef enum mpm_child_status {
+ MPM_CHILD_STARTED,
+ MPM_CHILD_EXITED,
+ MPM_CHILD_LOST_SLOT
+} mpm_child_status;
+
+/**
+ * Allow a module to remain aware of MPM child process state changes,
+ * along with the generation and scoreboard slot of the process changing
+ * state.
+ *
+ * With some MPMs (event and worker), an active MPM child process may lose
+ * its scoreboard slot if the child process is exiting and the scoreboard
+ * slot is needed by other processes. When this occurs, the hook will be
+ * called with the MPM_CHILD_LOST_SLOT state.
+ *
+ * @param s The main server_rec.
+ * @param pid The id of the MPM child process.
+ * @param gen The server generation of that child process.
+ * @param slot The scoreboard slot number, or -1. It will be -1 when an
+ * MPM child process exits, and that child had previously lost its
+ * scoreboard slot.
+ * @param state One of the mpm_child_status values. Modules should ignore
+ * unrecognized values.
+ */
+AP_DECLARE_HOOK(void,child_status,(server_rec *s, pid_t pid, ap_generation_t gen,
+ int slot, mpm_child_status state))
+
+/**
+ * Allow a module to be notified when the last child process of a generation
+ * exits.
+ *
+ * @param s The main server_rec.
+ * @param gen The server generation which is now completely finished.
+ */
+AP_DECLARE_HOOK(void,end_generation,(server_rec *s, ap_generation_t gen))
+
/* Defining GPROF when compiling uses the moncontrol() function to
* disable gprof profiling in the parent, and enable it only for
* request processing in children (or in one_process mode). It's