IO timeout in threaded application
Gordon Messmer
yinyang at eburg.com
Tue Aug 12 19:45:43 EDT 2003
Gordon Messmer wrote:
> The other approach I'd thought about would be to open a pipe and fork a
> process to do the check. The external process could handle signals
> properly.
This almost works right, except that the new pid ends up as a zombie...
Why doesn't the main thread reap the status of this process? I don't
get zombies if I start a thread and use os.system() or os.popen2() (both
of which should also fork & exec):
>>> def test2():
... child=os.fork()
... if not child:
... print "newpid", os.getpid()
... time.sleep(30)
... print 'returning from test2'
... os._exit(0)
...
>>> import thread
>>> thread.start_new_thread( test2, () )
1125342512
>>> newpid 21072
returning from test2
$ ps axfm| grep python
21060 pts/2 S 0:00 | \_ python
21072 pts/2 Z 0:00 | \_ [python <defunct>]
More information about the Python-list
mailing list