[Twisted-Python] thread pool question

Rutt, Benjamin Benjamin.Rutt at gs.com
Thu Mar 22 18:03:29 EDT 2007


Still isn't working for me:

#!/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(lambda _: reactor.stop())

Does this work for you? 




More information about the Twisted-Python mailing list