Thread-blocking (was: socket.gethostbyname() thread-safe?)

Aahz Maruch aahz at panix.com
Thu Apr 12 22:06:45 EDT 2001


In article <3AD61FE3.F06DFA2A at stroeder.com>,
Michael =?iso-8859-1?Q?Str=F6der?=  <michael at stroeder.com> wrote:
>
>I could track down the problem a little bit more: The threads are
>blocking if the user aborts the loading of the web page (using the
>SocketServer.ThreadingMixIn). In this case an IOError exception is
>raised which never reaches the appropriate handler thread. The
>IOError exceptions show up after I stop my main thread. Any
>solution?

You need to wrap the code for each I/O call in something like this:

try:
    # I/O call
except IOError:
    # handle exception

If the exceptions are going directly to the main thread, you've probably
got a platform problem with signals.  I'm not familiar with
SocketServer, so I don't know how to translate this to your specific
situation.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het Pythonista   http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Why is this newsgroup different from all other newsgroups?



More information about the Python-list mailing list