From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2004-06-22 17:31:12
Gregory Colvin wrote:
> Normally you don't want to leak resources, which may or may not involve
> zombies. And even if zombies are involved, reclaiming them need not
> require a signal handler, which was my original point.
oh ? Any call to fork() should be accompagnied by a call to wait()
(or one of its cousins such as 'waitpid()'). The only question is whether
that has to happen synchronously or asynchronously.
Calling 'wait()' synchronously basically means to block right after 'fork()'
has been called untill the child process terminates. One technique that
uses this approach is to detach the subprocess, i.e. to fork twice, and while
the grand-child carries out the actual task, the child finishes immediately.
The much more frequent situation is to call it asynchronously, i.e. the call
would be either executed from inside the SIGCHLD handler or somehow triggered
by it (such as a semaphore, which is reentrant).
Do I miss something ?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk