self._reset_timers()
def _reset_timers(self, initialize=False):
- if self._timeoutId is None:
+ if self._onTimeout.is_running():
return # not started yet
_moduleLogger.info("%s Resetting State Machine" % (self._name, ))
self._onTimeout.cancel()
else:
self.__idleId = gobject.idle_add(self.__func)
+ def is_running(self):
+ return self.__idleId is not None
+
def cancel(self):
if self.__idleId is not None:
gobject.source_remove(self.__idleId)
else:
timeout_add_seconds(timeoutInSeconds, self._on_once)
+ def is_running(self):
+ return self.__timeoutId is not None
+
def cancel(self):
if self.__timeoutId is not None:
gobject.source_remove(self.__timeoutId)