aboutsummaryrefslogtreecommitdiff
path: root/operationscore
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2010-12-29 12:43:05 -0500
committerGravatar rcoh <rcoh@mit.edu>2010-12-29 12:43:05 -0500
commitc8209d01f9ddf4c6670caee08073924cb33e447f (patch)
tree1e649deb239e56d8f5c5f95482bf78c70c393ebf /operationscore
parentf9aeaf10e3c9077504a78374640e79415734546b (diff)
setting up some more behaviors to get inherited from
Diffstat (limited to 'operationscore')
-rw-r--r--operationscore/Input.py7
-rw-r--r--operationscore/SmootCoreObject.py2
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):