[Twisted-Python] thread pool question

Manlio Perillo manlio_perillo at libero.it
Thu Mar 22 14:40:37 MDT 2007


Rutt, Benjamin ha scritto:
> Thanks but that runs forever for me too (twisted 2.0.0).
> 
> Does this stop for you?
> 
> #!/usr/bin/env python
> from twisted.internet import reactor
> from twisted.internet import threads
> 
> def aSillyBlockingMethod(x):
>     import time
>     time.sleep(2)
>     print x
> 
> d = threads.deferToThread(aSillyBlockingMethod, "2 seconds have passed")
> d.addBoth(reactor.stop)
> 

Sorry.
It should be
d.addBoth(lambda _: reactor.stop())


Regards   Manlio Perillo




More information about the Twisted-Python mailing list