Hitting Ctrl-c while the below is executing has no immediate effect. I am just casually wondering what are my best options [on Linux] to have it terminated gracefully when I send SIGINT to the parent process, assuming payload
is a black box.
from time import sleep
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
def payload():
sleep(10)
def wrapper():
with ThreadPoolExecutor(1) as pool:
pool.submit(payload).result()
if __name__ == "__main__":
with ProcessPoolExecutor(1) as pool:
pool.submit(wrapper).result()