You should write a cleanup routine and use register_cleanup() to register
it then you'll be called during pool cleaning regardless of whether it
times out or not. There are examples of how to do this here and there...
see note_cleanups_for_fd () and look for cases where the cleanups are done
early for methods of how to do that. You have to block_alarms() while
unregistering to be safe.
Dean
On Tue, 22 Apr 1997 rasmus@bellglobal.com wrote:
> Now that we are on this topic, might it be possible to define a module
> cleanup function for Apache modules? Looking at the code, it seems like
> this should be done from the timeout() function in http_main.c.
>
> I am currently manageing my own file descriptors. I should probably be
> using the popen functions from alloc.c, but the various SQL engines that
> mod_php can talk to prefer to have their various close connection functions
> called as well instead of just shutting down the sockets.
>
> I might solve this by making my Exit function the SIG_PIPE handler and then
> in turn having my Exit function call Apache's timeout function. I don't
> think this can be done for SIGALRM nor SIGURG though. It seems like a good
> way to solve it would be to let modules define an optional exit/cleanup
> function.
>
> Am I off my rocker here? Have I missed an obvious solution?
>
> -Rasmus
>
|