Problem with fork

Bryan Castillo rook_5150 at yahoo.com
Mon Oct 21 22:46:55 CEST 2002


This is a *nix question.

> There is something I don't understand. I've create simple program below in
> my Linux:
<snip>
> import os, sys, time

<add>
import signal

> 
> if os.fork(): sys.exit()
> os.setsid()

<add>
signal.signal(signal.SIGCHLD, signal.SIG_IGN)

> 
> for child in range(10):

<snip>

> Parent creates 10 childs in sequence by fork. It works ...
> But, everytime the child process exits, it leaves <defunct> in my process
> status.

Look up man pages for wait(2) waitpid(2) and signal2)



More information about the Python-list mailing list