IO timeout in threaded application

Gordon Messmer yinyang at
Tue Aug 12 19:29:16 CEST 2003

Skip Montanaro wrote:
>     Gordon> What's the easiest way to accomplish that?  Should I just
>     Gordon> subclass smtplib's SMTP class and override the "connect"
>     Gordon> function with one that creates a socket with a timeout?
> Right now that's probably your best bet.  Setting timeouts from higher-level
> packages which use sockets has not yet been tackled.

The only concern I have with that approach is that the behavior of the 
parent's function may change, and the class will break.

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 

So... following a fork(), how would I prepare the new process to receive 
signals (i.e. make the new process a single "thread" again)?

More information about the Python-list mailing list