Skip to content

Commit

Permalink
Merge pull request #4216 from randombit/jack/close-thread-pool
Browse files Browse the repository at this point in the history
Close the multiprocessing ThreadPool
  • Loading branch information
randombit authored Jul 16, 2024
2 parents d2bc625 + 64a2434 commit 5477167
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/scripts/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1921,13 +1921,13 @@ def main(args=None):
start_time = time.time()

if threads > 1:
pool = ThreadPool(processes=threads)
results = []
for test in tests_to_run:
results.append(pool.apply_async(run_test, test))
with ThreadPool(processes=threads) as pool:
results = []
for test in tests_to_run:
results.append(pool.apply_async(run_test, test))

for result in results:
result.get()
for result in results:
result.get()
else:
for test in tests_to_run:
run_test(test[0], test[1])
Expand Down
12 changes: 6 additions & 6 deletions src/scripts/test_cli_crypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ def main(args=None):
start_time = time.time()

if threads > 1:
pool = ThreadPool(processes=threads)
results = []
for test in kats:
results.append(pool.apply_async(test_cipher_kat, (cli_binary, test)))
with ThreadPool(processes=threads) as pool:
results = []
for test in kats:
results.append(pool.apply_async(test_cipher_kat, (cli_binary, test)))

for result in results:
result.get()
for result in results:
result.get()
else:
for test in kats:
test_cipher_kat(cli_binary, test)
Expand Down

0 comments on commit 5477167

Please sign in to comment.