[Twisted-Python] deferToThread and thread pool
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? 2. Which thread are the callbacks and errbacks of the deferred returned by deferToThread run in? Thanks in advance! Brian
On 8/31/05, Brian Granger <bgranger@scu.edu> 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
2. Which thread are the callbacks and errbacks of the deferred returned by deferToThread run in?
The reactor (i.e., probably the main) thread. -- Twisted | Christopher Armstrong: International Man of Twistery Radix | -- http://radix.twistedmatrix.com | Release Manager, Twisted Project \\\V/// | -- http://twistedmatrix.com |o O| | w----v----w-+
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.I... http://twistedmatrix.com/projects/core/documentation/howto/threading.html#au...
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.
participants (3)
-
Andrew Bennetts
-
Brian Granger
-
Christopher Armstrong