Clean up timer thread remove unnecessary is_running conditional check

Change-Id: I7bcba9d93ea7d9c1b2ed72ba142d021728fb7192
This commit is contained in:
Vinod 2016-12-23 04:39:59 -08:00 committed by Vinod Pandarinathan
parent a6aee6794b
commit 26e39000c2
1 changed files with 2 additions and 6 deletions

View File

@ -43,19 +43,15 @@ class cpulseTimer(object):
self.function = function
self.args = args
self.kwargs = kwargs
self.is_running = False
self.start()
def _run(self):
self.is_running = False
self.start()
self.function(self, *self.args, **self.kwargs)
def start(self):
if not self.is_running:
self._timer = Timer(self.interval, self._run)
self._timer.start()
self.is_running = True
self._timer = Timer(self.interval, self._run)
self._timer.start()
def test_run(**kwargs):