事例:
from concurrent.futures import ThreadPoolExecutor, wait, ALL_COMPLETED, FIRST_COMPLETED
def main(args):
print(args)
if __name__ == "__main__":
executor = ThreadPoolExecutor(max_workers=3)
all_task = [ executor.submit(main, (args)) for i in range(3)]
wait(all_task, return_when=ALL_COMPLETED)
print("finish")
网友评论