You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Klaus Keppler <kl...@informatik.stud.uni-erlangen.de> on 2004/01/27 12:32:22 UTC

apr_terminate with multiple processes?

Hello everybody,

a little question on apr_terminate: the docs say that an application 
should call that function when leaving this world - best way to
do this is using "atexit".

But what if I fork some childs  using apr_proc_fork? As I see in
threadproc/unix/proc.s there are no subpools created before
calling fork. When I want to daemonize my process, I usually
fork() one time and let the (old) main prozess exit.
If I am right, that main process should *not* call apr_terminate,
when one or more of its childs continue working...?!

    Klaus


Re: apr_terminate with multiple processes?

Posted by Klaus Keppler <kl...@informatik.stud.uni-erlangen.de>.
Hmm... it's really too early for my brain... ;-)

Daemonizing is best done with apr_proc_detach, and that one calls
just "fork()" (not apr_proc_fork). By the way, for what reason takes
apr_proc_detach no apr_pool_t argument, but apr_proc_fork does?

Additionaly, fork() creates a whole copy of the process, thus
it shouldn't be wrong to clean up (with apr_terminate) when
the start process terminates, isn't it?

Klaus


Klaus Keppler schrieb:
> Hello everybody,
> 
> a little question on apr_terminate: the docs say that an application 
> should call that function when leaving this world - best way to
> do this is using "atexit".
> 
> But what if I fork some childs  using apr_proc_fork? As I see in
> threadproc/unix/proc.s there are no subpools created before
> calling fork. When I want to daemonize my process, I usually
> fork() one time and let the (old) main prozess exit.
> If I am right, that main process should *not* call apr_terminate,
> when one or more of its childs continue working...?!
> 
>    Klaus
> 
>