On Sep 28, 2014, at 6:56 PM, Joshua Bartlett
On 26 September 2014 08:31, Glyph Lefkowitz
wrote: So, does anyone out there have any code which makes use of the aforementioned bad attributes of ThreadPool, whose applications would break if I removed them? If so, how can I make you feel as bad about yourselves for using it as I feel bad about myself for writing it? ;-) There are a few times in a codebase I help maintain where we want a thread pool of all daemon threads. The code we have for this overrides threadFactory() like so:
class DaemonThreadPool(ThreadPool): def threadFactory(self, *args, **kwargs): t = threading.Thread(*args, **kwargs) t.setDaemon(True) return t
How would I do this with your proposed new API?
I suppose honoring the threadFactory attribute is possible. In the new thread pool prototype I've created so far, "Team", provides pluggability for creating different kinds of "Worker": https://github.com/twisted/twisted/blob/desynchronize-2673/twisted/threads/_... and the thread "Worker" provides pluggability for creating different kinds of thread: https://github.com/twisted/twisted/blob/desynchronize-2673/twisted/threads/_... so I'll make sure that this keeps working. That said: why did you need a threadpool of daemon threads? -glyph