IO timeout in threaded application

Gordon Messmer yinyang at eburg.com
Thu Aug 14 12:37:19 EDT 2003


Gordon Messmer wrote:
> 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?

For the archives, in case anyone follows this thread:

POSIX systems seem to deliver the SIGCHLD from the forked process to the
thread that spawned it, and not to the parent process.  Threads block
all signals, so there's nothing to reap the status of the process.  In
order to collect the status of the forked process, the thread that
created it must call os.waitpid() with the result of os.fork() as the
first argument.  Manually collecting the status of the forked process
will avoid zombies.








More information about the Python-list mailing list