urllib.urlopen + https = all threads locked?
Jeff Johnson
usenet at jeffjohnson.net
Thu Oct 25 15:48:08 EDT 2001
Here's a test script and output that demonstrates that opening a HTTPS
url freezes other threads.
Thanks for the help,
-Jeff
=== OUTPUT ===
time between ticks = 0.00
time between ticks = 0.22
time between ticks = 0.51
Opening HTTPS://www.digitalegroup.com/ea/ThreadTest3.
Finished.
time between ticks = 3.69
time between ticks = 0.50
Opening HTTP://www.digitalegroup.com/ea/ThreadTest3.
time between ticks = 0.51
time between ticks = 0.51
time between ticks = 0.51
time between ticks = 0.51
time between ticks = 0.51
time between ticks = 0.51
time between ticks = 0.51
Finished.
time between ticks = 0.51
time between ticks = 0.51
=== SCRIPT ===
from threading import Thread
import urllib, time
def read(url):
print "Opening %s." % url
f = urllib.urlopen(url)
print "Finished."
def ticker():
t1 = time.time()
while 1:
t2 = time.time()
print " time between ticks = %0.2f" % (t2 - t1)
t1 = time.time()
time.sleep(.5)
t2 = Thread(target=ticker)
t2.setDaemon(1)
t2.start()
time.sleep(1)
read("HTTPS://www.digitalegroup.com/ea/ThreadTest3")
time.sleep(1)
read("HTTP://www.digitalegroup.com/ea/ThreadTest3")
time.sleep(1)
More information about the Python-list
mailing list