Is there a non-blocking way to wait or come back to this function within twisted?
I have a loop ticker that is just set to tick
on a set interval and that is all working GREAT. However, when stopping it I want to make sure that it isn't currently in a Tick
doing any work. If it is I just want twisted to come back to it and kill it in a moment.
def stop(self):
import time
while self.in_tick:
time.sleep(.001) # Blocking
self.active = False
self.reset()
self.timer.stop()
Sometimes this above function gets called while another thread is running a Tick
operation and I want to finish the Tick
and then come back and stop this.
I DO NOT want to block the loop in anyway during this operation. How could I do so?