import threadpool
def hello(name):
for i in range(0,5):
print(name+str(i))
if __name__ == "__main__":
# print(hello("test"))
val_pool=[]
for i in range(0,2):
var_dict={"name":"test"+str(i)}
var_tup=(None,var_dict)
val_pool.append(var_tup)
print(val_pool)
pool=threadpool.ThreadPool(10)
requests = threadpool.makeRequests(hello, val_pool)
for req in requests:
pool.putRequest(req)
pool.wait()
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/272883.html