Re: [gtk-list] Re: fork()/exec() round 2
- From: James Bailie <jazzturk home com>
- To: Gtk+ Mailing List <gtk-list redhat com>
- Subject: Re: [gtk-list] Re: fork()/exec() round 2
- Date: Tue, 25 May 1999 17:23:04 -0400
Andrew Wood writes:
> waitpid (-1, 0, WNOHANG); /* reap any zombie children */
Really, it means reap one dead child. It's not a zombie yet. That's what we're
trying to avoid. Slapping a loop around the call, like this:
while( waitpid( -1, 0, WNOHANG ) > 0 );
is useful in a SIGCHLD handler, if you have multiple child processes, as
signals are not queued under *NIX, so a child dying during the execution of
the SIGCHLD handler would be missed otherwise. It may be missed anyway,
if the execution of your handler has passed this statement, so it's a good
idea to call your handler, when you exit as well, to clean up any missed
dead children.
--
James Bailie
http://users.imag.net/~lon.jbailie
--
--
James Bailie
http://users.imag.net/~lon.jbailie
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]