def quit(self): self.pipe_semaphore.set() if self.runner_process and self.runner_process.is_alive(): self.runner_process.terminate() logger.log(DEBUG_B, 'releasing semaphore') raise urwid.ExitMainLoop()