[Twisted-Python] Deferred model

Alex Levy mesozoic at polynode.com
Thu Nov 13 13:33:36 EST 2003


On Thu, 2003-11-13 at 11:39, Philippe Lafoucrière wrote:
> where do I put my blocking code ? just before the defer.succeed ??

I'm sure this has been answered a million times before, but here goes...

Deferreds do not magically turn blocking code into non-blocking code. If
you place blocking code in a wmfactory_ method, it will still interfere
with the event loop.

If you have blocking code, you can either rewrite it in a non-blocking
manner, or you can use a separate thread to run it.
<http://twistedmatrix.com/documents/howto/threading>

If you give more detail about what you're trying to do, I'm sure one of
the Twisted gurus can explain what the best approach(es) might be.

-- 
Alex Levy
WWW: http://mesozoic.geecs.org

"Never let your sense of morals prevent you from doing what is right."
-- Salvor Hardin, Isaac Asimov's _Foundation_

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20031113/2d361a81/attachment.pgp 


More information about the Twisted-Python mailing list