[Twisted-Python] INCOMPATIBLE CHANGE: twisted.python.threadpool
Glyph
glyph at twistedmatrix.com
Tue Sep 30 22:09:12 MDT 2014
On Sep 28, 2014, at 6:56 PM, Joshua Bartlett <josh at bartletts.id.au> wrote:
> On 26 September 2014 08:31, Glyph Lefkowitz <glyph at twistedmatrix.com> 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/_team.py#L15>
and the thread "Worker" provides pluggability for creating different kinds of thread:
<https://github.com/twisted/twisted/blob/desynchronize-2673/twisted/threads/_threadworker.py#L15>
so I'll make sure that this keeps working.
That said: why did you need a threadpool of daemon threads?
-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20140930/14f31800/attachment-0002.html>
More information about the Twisted-Python
mailing list