Hello folks,

I am new to apache modules and I am trying to get a better understanding of
how cleanup works. I have Nick Kew's book and it has been a tremendous help.
I hope someone can hep clarify some of the questions that I have.

I have written a module which links in to some other libraries that I have.
In my_module_init from below:

ap_hook_child_init(my_module_init, NULL, NULL, APR_HOOK_MIDDLE);


I call the initialization routines for my own libraries. Also in init, I
register a cleanup function like this:

apr_pool_cleanup_register(pool, (const void*)svr_rec, my_child_exit,
                apr_pool_cleanup_null);


In the my_child_exit function, all I do is call my library's finalize
function to clean up resources.

Is this the right way to do the clean up? Instead of the above line of code,
should I be passing NULL as the second argument for the
apr_pool_cleanup_register function like I have seen in some of the examples
on the web:

apr_pool_cleanup_register(pool, NULL, my_child_exit,
                apr_pool_cleanup_null);


Thanks,
Subra

Reply via email to