5,321
edits
Line 338: | Line 338: | ||
executor = ThreadPoolExecutor(max_workers=2 * os.cpu_count()) | executor = ThreadPoolExecutor(max_workers=2 * os.cpu_count()) | ||
thread_lock = threading.Lock() | thread_lock = threading.Lock() | ||
total = 0 | |||
def do_something(a, b): | def do_something(a, b): | ||
with thread_lock: | with thread_lock: | ||
total += a + b | |||
return | return total | ||
futures = [] | futures = [] |