def Normal(args):
def startMessages():
for key in sendMSGSequence:
self.deferQueue.put(key)
sleep(1) # simulate like a real GUI serial Connection.
#print key
reactor.callLater(1, startMessages)
The inner function will execute after 1 second callback from the reactor function. The Reactor is continue is execution with being block.
This method is not asynchronous, I was wrong!!!
ReplyDeletePlease use:
d = threads.deferToThread(startMessages)
d.addCallback(somefunction)
This will create a defered thread make the event non-blocking.