[Twisted-Python] New user questions
Andrew Bennetts
andrew-twisted at puzzling.org
Sun Feb 6 19:55:10 MST 2005
On Sun, Feb 06, 2005 at 06:28:57PM -0800, snacktime wrote:
> I'm having some problems playing with Deferreds and I think it's due
> to using threads. In the following code, will printResult be called
> in the thread? printResult is inside the protocol handler for a
> simple echo server, and when calling transport.write it doesn't seem
> to write anything, and I'm wondering if it's because it's being called
> inside a thread?
>
> d = threads.deferToThread(doLongCalculation)
> d.addCallback(printResult)
In this code, printResult will not be called in a thread.
-Andrew.
More information about the Twisted-Python
mailing list