some little fixes

This commit is contained in:
Bastian Schroll 2018-09-25 10:08:00 +02:00
parent 7d2935ea0d
commit 3eac36d123
2 changed files with 14 additions and 10 deletions

View file

@ -66,13 +66,17 @@ class RepeatedTimer:
"""!Stop the timer worker thread
@return True or False"""
self._event.set()
if self._thread is not None:
logging.debug("stop repeatedTimer: %s", self._thread.name)
self._thread.join()
try:
self._event.set()
if self._thread is not None:
logging.debug("stop repeatedTimer: %s", self._thread.name)
self._thread.join()
return True
logging.warning("repeatedTimer always stopped")
return True
logging.warning("repeatedTimer always stopped")
return False
except: # pragma: no cover
logging.exception("cannot stop repeatedTimer")
return False
def _target(self):
"""!Runs the target function with his arguments in own thread"""