5,321
edits
Line 366: | Line 366: | ||
import os | import os | ||
import threading | import threading | ||
from concurrent.futures import ThreadPoolExecutor, as_completed | |||
from concurrent.futures import ThreadPoolExecutor | |||
executor = ThreadPoolExecutor(max_workers=os.cpu_count()) | executor = ThreadPoolExecutor(max_workers=os.cpu_count()) | ||
Line 383: | Line 382: | ||
my_futures.append(future) | my_futures.append(future) | ||
for future in as_completed(my_futures): | |||
future.result() | future.result() | ||
executor.shutdown() | executor.shutdown() |