Managing concurrent.futures exit-handlers

Remy NOEL mocramis at gmail.com
Thu Feb 27 05:48:05 EST 2020


Hello !

I am currently using concurrent.futures ThreadPoolExecutor, but i am
annoyed by its exit_handler preventing program exit if any of the jobs it
is running is blocked.

Currently i can workaround it by either unregister the exit handler
concurrent.futures.thread._python_exit or by subclassing the
threadpoolExecutor and overriding the _adjust_thread_count method with one
that does not register its threads queues.

Both seems kinda ugly though.

I was wondering if there was a better way.
Also, would adding an option to executors so that their worker threads is
not be globally joined  was conceivable.

Thanks !

Remy Noel


More information about the Python-list mailing list