Commit 1ad85e20 authored by Chris Darroch's avatar Chris Darroch
Browse files

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
parent e81f613a
Loading
Loading
Loading
Loading
+4 −0
Changes for CHANGES: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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]
+15 −0
Changes for server/mpm/beos/beos.c: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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;
}