使用ProcessPoolExecutor创建进程池,但并未执行所有任务,仅仅执行了设置的最大进程数的任务主进程就结束了

executor = ProcessPoolExecutor(max_workers=3)
if name == ‘main’:

for i in range(0, 8):
    future = executor.submit(main, i)
    print(future.done())

执行结果:
E:\python\python38\python.exe E:/pywork/T_db/main.py
False
False
False
False
False
False
False
False
error_1
正在比较文件./1/old_1.txt 和 ./1/new_1.txt
error_0
正在比较文件./0/old_0.txt 和 ./0/new_0.txt
0==}==========> Successfully Finished

0==}==========> Successfully Finished

error_2
正在比较文件./2/old_2.txt 和 ./2/new_2.txt
0==}==========> Successfully Finished

Process finished with exit code 0

关闭