当前位置:   article > 正文

python线程池ThreadPoolExecutor_with threadpoolexecutor() as executor:

with threadpoolexecutor() as executor:
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor, wait, ALL_COMPLETED

results = []
with ThreadPoolExecutor(max_workers=32) as executor:
    for a in []:
        results.append(executor.submit(main, a))
    results = [res.result() for res in results]
    wait(results, return_when=ALL_COMPLETED)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/74892
推荐阅读
相关标签
  

闽ICP备14008679号