Roman, Stut and Jochem, thanks for the comments and recommendations on the
subject.
I have installed my signal as  pcntl_signal(SIGCHLD, SIG_IGN)  without a
specific function handler and it is closing child processes now. I could not
use the pcntl_wait because it is available after PHP 5.0 i guess.



-----Original Message-----
From: Roman Neuhauser [mailto:[EMAIL PROTECTED]
Sent: Friday, December 08, 2006 7:02 PM
To: Jochem Maas
Cc: php-general@lists.php.net
Subject: Re: [PHP] signal handling


# [EMAIL PROTECTED] / 2006-12-08 15:36:52 +0100:
> Roman Neuhauser wrote:
> > # [EMAIL PROTECTED] / 2006-12-02 02:01:35 +0200:
> >> [...] to write a simple socket server in PHP. My current example just
> >> prints the same character, you send to server from keyboard. It is
> >> successfull in forking, and generates child as people connect. However
in
> >> any way the client exits, the child process remains defunct on system.

> >     The parent needs to wait(2) for its children.
http://php.net/pcntl_wait
>
> have I understood correctly that using pcntl_wait() means you can't do
anything in
> the parent process until all children are dead?

    no.

> but if it is true how do you go about tackling the signal handling in
child processes
> AND at the same time have the parent process do something useful like ...
> interact/direct child processes, do other management tasks whilst child
processes are running?

do whatever you want, either have a SIGCLD handler, or check one of the
wait(2)-family functions every now and then (and make sure to use
WNOHANG).

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to