import time
import threadpool
#执行比较耗时的函数,需要开启多线程
def myfun(L):
time.sleep(5)
print(L[0])
print(L[1])
return
#使用多线程执行myfun函数
pool = threadpool.ThreadPool(3)
requests = threadpool.makeRequests(myfun, [[1,2],[3,4],[5,6]])
[pool.putRequest(req) for req in requests]
pool.wait()
print ("hello")
gevent程序员指南
http://xlambda.com/gevent-tutorial/#_8
Python 并行任务技巧
http://www.open-open.com/lib/view/open1390221982539.html