Fix exception handling

This commit is contained in:
Andras Schmelczer 2022-07-01 23:50:31 +02:00
parent 835f9b4ba0
commit 9866b88faf
2 changed files with 17 additions and 15 deletions

View file

@ -106,10 +106,14 @@ def parallel_map(
unordered=unordered,
ignore_exceptions=ignore_exceptions,
)
finally:
should_stop.set()
for p in processes:
p.join()
p.close()
except:
for p in processes:
p.terminate()
raise
finally:
input_queue.close()
output_queue.close()