I am currently developing a module for Apache 2/2.2 and need to perform some cleanup before the main Apache process terminates (not the child processes).
I have searched extensively without finding any guidelines on which hook to use. Can anyone help point me in the right direction?
I’m not sure what you are exactly trying to do, but I think that the apr_reslist_create and apr_pool_cleanup_register functions may help you. One of the parameters in the apr_reslist_create function is apr_reslist_destructor which you can use to pass destructor function. Also, I think you should take a look at the mod_dbd module source code since it is a pretty good example of how to create and cleanup external resources from the apache process.
Apr-Util apr_reslist_create
Apr apr_pool_cleanup_register