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

2015-08-17 Thread Matt Spitz
Matt Spitz added the comment: On further investigation, it appears that we can't just check against the queue length, as it doesn't indicate whether threads are doing work or idle. A change here will need a counter/semaphore to keep track of the number of idle/working threads, whic

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

2015-08-17 Thread Matt Spitz
Changes by Matt Spitz : -- title: ThreadPoolExceutor doesn't reuse threads until #threads == max_workers -> ThreadPoolExecutor doesn't reuse threads until #threads == max_workers ___ Python tracker <http://bugs.pytho

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

2015-08-17 Thread Matt Spitz
New submission from Matt Spitz: https://hg.python.org/cpython/file/3.4/Lib/concurrent/futures/thread.py#l114 ThreadPoolExecutor will keep spawning new threads, even if existing threads are waiting for new work. We should check against the queue length when deciding to spawn a new thread to