[issue24882] ThreadPoolExecutor doesn't reuse threads until #threads == max_workers

iunknwn report at bugs.python.org
Thu Apr 5 18:45:50 EDT 2018


iunknwn <sz2243 at gmail.com> added the comment:

I've submitted a PR that should resolve this - it uses a simple atomic counter to ensure new threads are not created if existing threads are idle. 

One concern I do have - while writing the patch, I noticed the existing submit method (specifically the adjust_thread_count function) isn't thread safe. I've added more details in the PR.

----------
components: +Library (Lib)

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue24882>
_______________________________________


More information about the Python-bugs-list mailing list