apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Lotspeich <e...@lotspeich.org>
Subject Help with apr_proc API
Date Thu, 25 Oct 2007 07:03:00 GMT
Hi,

I tried searching on the Internet and I have "The Apache Modules Book" by 
Nick Kew.  I haven't been able to find an answer to my question so far.

I am writing an Apache module that will spawn a configurable number of 
"server-type" processes.  The Apache module will handle incoming requests 
and forward them to these spawned server processes.

I would like to use the apr_proc API to spawn these processes and manage 
them (e.g. kill, respawn if crashed, etc.).  It seems as though the 
apr_proc function calls are well-equipped to handle this situation.  The 
documentation I've seen (http://apr.apache.org/docs/apr/1.2) doesn't 
provide enough detail for me to grasp how to use the more advanced part of 
this API.

It seems as though I want to spawn these server processes as detached and 
then use apr_proc_other_child_register() to register a maintenance 
callback so that I can be notified if they are killed.  It seems as though 
to make this mechanism work, I'll need to call 
apr_proc_other_child_refresh_all() to refresh the status (which will call 
the maintenance function, as needed).

Is this the correct approach?

I suppose I could also start a thread that starts the server process not 
detached and waits with apr_proc_wait().  This approach seems convoluted 
and it raises the question of how to cull the server processes that are 
spawned from the thread.

I hope that I've described the problem clearly enough.  Any help you can 
give me would be greatly appreciated.

Regards,

Erik.

Mime
View raw message