[Twisted-Python] Has anybody integrated multiple threadpools into reactor?
andrew-twisted at puzzling.org
Thu Oct 21 06:31:42 EDT 2004
On Thu, Oct 21, 2004 at 11:45:39AM +0200, Ames Andreas (MPA/DF) wrote:
> Now what I'd like to have is two distinct thread(s/ pools) for them.
> One of them would have a threadpool size of 1 (one) because the C-lib
If you're using a threadpool of size one, why use a thread pool at all?
Just start a thread. You don't need (or want) any of the fancy worker
thread management that a thread pool is designed for.
There's nothing in Twisted that requires all your threads run in a Twisted
threadpool; they're just provided for convenience (mainly the convenience of
deferToThread). If all you need is a single thread, then
t = threading.Thread(target=foo)
works great. reactor.callFromThread works from any thread.
In a similar vein, there are times when I've found it simpler to start a
thread for database interactions, rather than use adbapi. The reason is
much the same: the "pool of workers" model didn't fit what I was trying to
More information about the Twisted-Python