plucury / pythonfutures

Automatically exported from code.google.com/p/pythonfutures
Other
0 stars 0 forks source link

Ctrl-C doesn't end the program #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using Python 2.7, and my program ignores SIGTERM signals when using 
ThreadPoolExecutor.

After some debugging I found that my main thread is blocked on Thread.join(), 
and it holds the interruption until the call returns.

My solution is to use join(timeout), as it will respect the interruptions and 
allow the program to exit properly.

The next issue I found was that the atexit hook will try to wait for pending 
threads anyway.
If the program ended without waiting on these, I suppose skipping this step is 
probably not too bad either.

Not a great solution, but works for me :)

Original issue reported on code.google.com by pa...@inutilfutil.com on 1 Nov 2013 at 11:57

Attachments: