httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <>
Subject Re: Cleanup when server is stopped vs reconfigured
Date Tue, 29 Mar 2016 07:40:56 GMT
On Tue, Mar 29, 2016 at 3:01 AM, Tony Abo <> wrote:
> Is there a way to run some cleanup code in a module when the server is being stopped,
but not being restarted? Or, can a cleanup handler in a loaded module determine whether the
server is being shut down or restarted?

With 2.4.x, you could use the ap_pglobal pool.

Beware this should be done only once by register_hooks (called at
every restart), so something like:
    void *data;

    apr_pool_userdata_get(&data, "my_module_key", ap_pglobal);
    if (!data) {
        char *key = apr_pstrdup(ap_pglobal, "my_module_key");
        apr_pool_userdata_set(key, key, apr_pool_cleanup_null, ap_pglobal);


View raw message