#以下是循环使用多进程,跑run方法,args后面是run方法跟的参数
#
from multiprocessing import Pool
len = 1
def run(c1, c2, c3):
pass
def main():
c1 = ""
c2 = ""
c3 = ""
while len>0:
# len = redisWriteserv.llen(redis_key)
res = pool.apply_async(run, args=(c1,c2,c3))
len = len - 1
# 等待所有进程执行完成
# res.wait()
pool.close()
pool.join()
if __name__ == '__main__':
main()
python官方建议:废弃apply,使用apply_async