Re: gtk in fork()ed process



On Thu, May 02, 2002 at 08:07:25PM +0200, Oliver Rauch wrote:
The parent process must not be stopped when the child process is running.
I don't know if this is true.. I see no problem for the main to be stopped
while child is running, but when the child dies a SIGCHLD is released to the
main process, and if it's stopped, the callback will or will not be executed?
But note that I'm meaning stopped a processes that got a SIGSTOP..

I now added an inter process comunication via pipe to display the error meassge
by the parent process.
Yes.. that's a good solution..

I think the cleanup of the zombie can be done in the parent process by a signal
handler (sigaction(SIGCHLD)).
For sure!
but just doing this would not clean up it.. you would just handle the signal..
you have to do this:
void sigchld_handler (int sig)
{
  pid_t pid;
  int status;
  pid = wait3 (&status, 0, NULL);
  /* do something usefull here.. */
  /* maybe consult a matrix to know which program it was */
}
main (...)
{
signal (SIGCHLD, sigchld_handler);
}

without the wait3, wait4-like functions the zombie process will remain at
the system, even if you catch the signal..
---end quoted text---

[]'s
-- 
Marcelo R Leitner <mrl netbank com br>
ICQ #: 29966851



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]