zombie question
jianchen at my-deja.com
jianchen at my-deja.com
Mon Jan 8 09:15:40 EST 2001
sure!
the parent process looks like this£º
------------------------------------------------------------
serv=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
try:
serv.bind((HOST,PORT))
except:
print "Can't bind to local port %s" % PORT
sys.exit(-1)
serv.listen(5)
signal.signal(signal.SIGCHLD,handler)
while 1:
conn,addr=serv.accept()
pid=os.fork()
if pid<0: myerr('Can\'t fork new process')
if pid==0: # the child process
serv.close(£©
proxy(conn,addr) # the real proxy
sys.exit(0)
conn.close()
------------------------------------------------------------
The handler is :
def handler(signum,frame):
pid,excode=os.waitpid(-1,os.WNOHANG)
return
------------------------------------------------------------
the most strange thing is that the handler is never called!
any advice. thanks!
Sent via Deja.com
http://www.deja.com/
More information about the Python-list
mailing list