From 2ae14a64d221f5344f49ad8005898bd94ef03082 Mon Sep 17 00:00:00 2001 From: Chris Darroch Date: Tue, 2 Jan 2007 20:13:57 +0000 Subject: [PATCH] Create pmain pool and run modules' child_init hooks when entering ap_mpm_run(), then destroy pmain when exiting ap_mpm_run(). The expected call to ap_run_child_init() appears to have been removed in r89640. However, that call should presumably still be made once per process, as in other single-process MPMs like the netware MPM. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@491922 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ server/mpm/beos/beos.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGES b/CHANGES index 654ad8e1b5..f4bd6bd636 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.3.0 [Remove entries to the current 2.0 and 2.2 section below, when backported] + *) beos MPM: Create pmain pool and run modules' child_init hooks when + entering ap_mpm_run(), then destroy pmain when exiting ap_mpm_run(). + [Chris Darroch] + *) netware MPM: Destroy pmain pool when exiting ap_mpm_run() so that cleanups registered in modules' child_init hooks are performed. [Chris Darroch] diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c index 30ed26d96c..7c97d941d1 100644 --- a/server/mpm/beos/beos.c +++ b/server/mpm/beos/beos.c @@ -102,6 +102,7 @@ static int mpm_state = AP_MPMQ_STARTING; apr_thread_mutex_t *accept_mutex = NULL; static apr_pool_t *pconf; /* Pool for config stuff */ +static apr_pool_t *pmain; /* Pool for httpd child stuff */ static int server_pid; @@ -146,6 +147,14 @@ static void clean_child_exit(int code, int slot) exit_thread(code); } +/* proper cleanup when returning from ap_mpm_run() */ +static void mpm_main_cleanup(void) +{ + if (pmain) { + apr_pool_destroy(pmain); + } +} + /***************************************************************** * Connection structures and accounting... @@ -898,6 +907,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) set_signals(); + apr_pool_create(&pmain, pconf); + ap_run_child_init(pmain, ap_server_conf); + /* Sanity checks to avoid thrashing... */ if (max_spare_threads < min_spare_threads ) max_spare_threads = min_spare_threads; @@ -972,6 +984,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) } if (one_process) { + mpm_main_cleanup(); return 1; } @@ -995,6 +1008,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) "caught SIGTERM, shutting down"); } + mpm_main_cleanup(); return 1; } @@ -1020,6 +1034,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) */ apr_thread_mutex_destroy(accept_mutex); + mpm_main_cleanup(); return 0; } -- 2.40.0