iunknwn <sz2...@gmail.com> added the comment:

I feel like there are two reasonable options here:

1) We can implement a thread pool with basic resource tracking. This means idle 
threads get recycled, and threads that have been sitting idle for a while are 
terminated as demand drops, so resources can be reclaimed. This wouldn't 
require very much work - we would just need to modify some of the queue 
operations to have timeouts, and track the number of idle threads (most of 
that's already in my first PR). We could easily add options like min_threads 
and idle_thread_timeout as options in kwargs to the init routine. 

2) We can skip all tracking, and spin a fixed number of threads at 
initialization. This removes the complexity of locks and counts, and means the 
thread pool executor will work identically to the process pool executor (which 
also eagerly spawns resources). If we want this, this is ready to go in the 
second PR. 

I personally like option 1 because it feels closer to other languages I've 
worked in, but I'd like a bit more guidance from the reviewers before 
proceeding.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue24882>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to