import time
import threading
import threadpool
def test(a, b):
print threading.current_thread(), a, b
time.sleep(1)
# 参数格式
data =[(['1','2'], None), (['3','4'], None)]
start_time = time.time()
# 创建线程池
pool = threadpool.ThreadPool(10)
# 执行线程
requests=threadpool.makeRequests(test, data)
[pool.putRequest(req) for req in requests]
pool.wait()
print '%d second'% (time.time()-start_time)