diff options
Diffstat (limited to 'operationscore')
-rw-r--r-- | operationscore/Input.py | 7 | ||||
-rw-r--r-- | operationscore/SmootCoreObject.py | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/operationscore/Input.py b/operationscore/Input.py index 62c4682..9e8841a 100644 --- a/operationscore/Input.py +++ b/operationscore/Input.py @@ -1,5 +1,6 @@ import threading,time from operationscore.SmootCoreObject import * +from logger import main_log, exception_log #Abstract class for inputs. Inheriting classes should call "respond" to raise #their event. Inheriting classes MUST define sensingLoop. Called at the #interval specified in RefreshInterval while the input is active. For example, if you are writing @@ -33,7 +34,11 @@ class Input(SmootCoreObject): except: return False def run(self): - while self.parentAlive(): + while 1: + try: + die = self.parentAlive() + except: + break time.sleep(self.argDict['RefreshInterval']/float(1000)) self.acquireLock() self.sensingLoop() diff --git a/operationscore/SmootCoreObject.py b/operationscore/SmootCoreObject.py index 9784aab..26b3fc2 100644 --- a/operationscore/SmootCoreObject.py +++ b/operationscore/SmootCoreObject.py @@ -19,7 +19,7 @@ class SmootCoreObject(threading.Thread): def releaseLock(self): self.lock.release() def className(self): - return str(self.__class__).split('.')[-1] #TODO: this doesn't work. + return self.__class__.__name__ def __setitem__(self,k, item): self.argDict[k] = item def __getitem__(self, item): |