from multiprocessing.dummy import Pool
def A(a):
pass
B = [a,b,c]
pool = Pool(6) #启动6个线程
pool.map(A,B)
pool.close()
pool.join() #等线程都结束后在执行主程序
python的多线程
最新推荐文章于 2024-01-17 16:35:13 发布
from multiprocessing.dummy import Pool
def A(a):
pass
B = [a,b,c]
pool = Pool(6) #启动6个线程
pool.map(A,B)
pool.close()
pool.join() #等线程都结束后在执行主程序