Alarms in threads - how to get/mimic?

Aahz Maruch aahz at panix.com
Sat Dec 16 16:19:52 CET 2000


In article <Pine.LNX.4.21.0012160248520.7483-100000 at traal.eecs.berkeley.edu>,
Luca de Alfaro  <dealfaro at eecs.berkeley.edu> wrote:
>
>I am trying to write a multi-threaded program to read web pages.  The
>program spawns (say) 10 threads, assigning to each thread a file to
>read with the ftp or http protocol; each thread reads it, and returns
>the info.
>
>The problem is that the threads sometimes hang for a very long time
>waiting for a connection (httplib seems to have very long timeouts??),
>whereas instead I don't care for the answer if it comes later than
>(say) a few seconds.

httplib does not timeout in its default state; the current best solution
is to download timeoutsocket.py.
-- 
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

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

"It's 106 miles to Chicago.  We have a full tank of gas, a half-pack of
cigarettes, it's dark, and we're wearing sunglasses."  "Hit it."



More information about the Python-list mailing list