import urllib MAX_THREADS = 5 THREAD_POOL = [] URL_LIST = [ "http://www.google.ca/intl/en_ca/images/logo.gif"] for i in range(0,MAX_THREADS): THREAD_POOL.append(i) def open(myurl, ID): urllib.urlopen(myurl) THREAD_POOL.append(ID) print THREAD_POOL while 1: for i in URL_LIST: if len(THREAD_POOL) > 0: print "Thread started" open(myurl,THREAD_POOL.pop()) else: print "Waiting for a free spot in the thread pool"