Ejemplo n.º 1
0
    def __init__(self, func, interval, max_run_time):
        
        StateController.__init__(self)

        self._func = func
        self._gap = interval
        self._max_run_time = max_run_time

        self._thread = threading.Thread(target=self._loop_thread)
        self._thread.daemon = True

        self._lock = threading.Lock()
        self._loop_active = True
Ejemplo n.º 2
0
 def stop(self):
     
     with self._lock:
         self._loop_active = False
     self._thread.join(timeout=20)
     StateController.stop(self)
Ejemplo n.º 3
0
 def start(self):
     
     StateController.start(self)
     self._thread.start()