def stop(self): """ Stop the thread and cleanup. """ log.info('stop mainloop') set_mainloop_running(False) main.wakeup() main.stop()
def __call__(self, *args, **kwargs): ret = self.func(*args, **kwargs) if self.loop.sleeping: main.wakeup() return ret