import multiprocessing as mp
nProcess = 2*mp.cpu_count()/3
if nProcess > 1:
pool = mp.Pool(nProcess)
res = pool.map(get_prx, gdic.keys())
else:
res = map(get_prx, gdic.keys())
最后一定要记得回收:
pool.close()
pool.join()
import multiprocessing as mp
nProcess = 2*mp.cpu_count()/3
if nProcess > 1:
pool = mp.Pool(nProcess)
res = pool.map(get_prx, gdic.keys())
else:
res = map(get_prx, gdic.keys())
最后一定要记得回收:
pool.close()
pool.join()