Re: [PHP4BETA] cvs: php4 / acconfig.h.in config.w32.h configure.in main.c

[email protected]
Newsgroups php.version4
Message-ID <[email protected]>
On Fri, May 19, 2000 at 01:31:40PM +0200, Sascha Schumann wrote:
> > +#if PHP_SIGCHILD
> > +static int sigchld_handler(int apar)
> > +{
> > +    int status;             
> > +    wait(&status);
> > +    signal(SIGCHLD,sigchld_handler);   
> > +}
> > +#endif
> 
> This is an often repeated error when dealing with reapers.
> 
> An arbitrary number of childs can exit while you are in the signal
> handler, so that no further SIGCHLD are delivered to the program.
> 
> The
> 
> 	wait(&status);
> 
> should be modified to
> 
> 	while (waitpid(-1, NULL, WNOHANG) > 0);
> 
> waitpid() will return immediately with -1, if no child has
> exited. Otherwise, it will return the pid of the child.
    fixed - thanx
> 
> - Sascha

-- 

Thies C. Arntzen                 "One Big-Mac, Small Fries and a Coke!"
Digital Collections             Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93                              20097 Hamburg / Germany
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.