Ejemplo n.º 1
0
 def stop(self):
     """
     Stop the thread and cleanup.
     """
     log.info('stop mainloop')
     set_mainloop_running(False)
     main.wakeup()
     main.stop()
Ejemplo n.º 2
0
 def handle(self):
     """
     Callback from the real mainloop.
     """
     try:
         try:
             notifier.step(sleep = False)
         except (KeyboardInterrupt, SystemExit):
             set_mainloop_running(False)
             notifier.shutdown()
     finally:
         self._lock.release()
Ejemplo n.º 3
0
 def run(self):
     """
     Thread part running the blocking, simulating loop.
     """
     set_mainloop_running(True)
     try:
         while True:
             self.sleeping = True
             notifier.step(simulate = True)
             self.sleeping = False
             if not main.is_running():
                 break
             self._call_mainloop(self.handle)
             self._lock.acquire()
             if not main.is_running():
                 break
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         log.exception('loop')