Clean up timer thread remove unnecessary is_running conditional check
Change-Id: I7bcba9d93ea7d9c1b2ed72ba142d021728fb7192
This commit is contained in:
parent
a6aee6794b
commit
26e39000c2
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user