On Tue, Mar 29, 2016 at 9:40 AM, Yann Ylavic <ylavic....@gmail.com> wrote: > On Tue, Mar 29, 2016 at 3:01 AM, Tony Abo <t...@hitech.com> 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);
Your registering goes here of course :) > } > } > > Regards, > Yann.