(self)
Thread main loop.
Thread main loop.
Thread main loop .
def run(self):
        "Thread main loop."

        # run startup, safely
        self.run_func_safely(self.startup)

        while 1:
            # reload config, if needed
            if self.need_reload:
                self.reload()
                self.need_reload = 0

            # do some work
            work = self.run_once()

            if not self.looping or self.loop_delay < 0:
                break

            # remember work state
            self.work_state = work
            # should sleep?
            if not work:
                if self.loop_delay > 0:
                    self.sleep(self.loop_delay)
                    if not self.looping:
                        break
                else:
                    break

        # run shutdown, safely?
        self.shutdown()
def run ( self ) : # run startup, safely self . run_func_safely ( self . startup ) while 1 : # reload config, if needed if self . need_reload : self . reload ( ) self . need_reload = 0 # do some work work = self . run_once ( ) if not self . looping or self . loop_delay < 0 : break # remember work state self . work_state = work # should sleep? if not work : if self . loop_delay > 0 : self . sleep ( self . loop_delay ) if not self . looping : break else : break # run shutdown, safely? self . shutdown ( )