I am new to Twisted framework, and I would like to make the program wait for the deferred thread to complete.
import time
from twisted.internet import defer, threads
a=None
def proc(n):
time.sleep(n)
print "Hi!!"
a=1
return
d = threads.deferToThread(proc,5)
while not a:
pass
print a
print "Done"
Is it possible to wait for the deferred to complete in a neat way rather than looping like this?