[Twisted-Python] deferToThread and thread pool
Andrew Bennetts
andrew-twisted at puzzling.org
Wed Aug 31 01:18:08 EDT 2005
On Tue, Aug 30, 2005 at 09:17:10PM -0700, Brian Granger wrote:
> I have a few questions about the default implementation of
> deferToThread.
>
> 1. Does deferToThread use a thread pool by default? If not, how can
> I enable this?
Yes. You can adjust the threadpool size using
reactor.suggestThreadPoolSize:
http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IReactorThreads.html#suggestThreadPoolSize
http://twistedmatrix.com/projects/core/documentation/howto/threading.html#auto4
> 2. Which thread are the callbacks and errbacks of the deferred
> returned by deferToThread run in?
The main thread, i.e. the reactor thread.
-Andrew.
More information about the Twisted-Python
mailing list