Relative Content

Tag Archive for pythonconcurrencyconcurrent.futures

Recursive use of ProcessPoolExecutor is Hanging

Problem I’m trying to use a ProcessPoolExecutor with recursive calls, but it doesn’t work. I created a minimal example below from concurrent.futures import ProcessPoolExecutor from time import sleep executor = ProcessPoolExecutor() i = 3 def test(): global i print(“top”) if i == 0: print(“bar”) return else: print(“foo”) i -= 1 p = executor.submit(test) print(p.result()) print(i) […]