aboutsummaryrefslogtreecommitdiff
path: root/operationscore/SmootCoreObject.py
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2010-12-08 16:39:50 -0500
committerGravatar rcoh <rcoh@mit.edu>2010-12-08 16:39:50 -0500
commitb335b746523ffd59db1402b097a802b3fd99eaac (patch)
tree74333be1820f3d2666358c3b009beb14bf929256 /operationscore/SmootCoreObject.py
parent353ab16db64c86122c0fcb9e1852b85c14b354b8 (diff)
Code for the demo. Everything works afaik. Contains a couple more optimizations. Contains modify param behavior. Improved support for recursive hooks. Modifications to SmootCoreObject to get us closer to a fully multi-threaded system. This should be the last commit directly to master. All further commits should be on subranches and get merged.
Diffstat (limited to 'operationscore/SmootCoreObject.py')
-rw-r--r--operationscore/SmootCoreObject.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/operationscore/SmootCoreObject.py b/operationscore/SmootCoreObject.py
index d29e710..8514b3e 100644
--- a/operationscore/SmootCoreObject.py
+++ b/operationscore/SmootCoreObject.py
@@ -1,16 +1,24 @@
import Util
import pdb
-class SmootCoreObject:
- def __init__(self, argDict):
+import threading
+import thread
+class SmootCoreObject(threading.Thread):
+ def __init__(self, argDict, skipValidation = False):
self.argDict = argDict
self.validateArgs(self.className()+'.params')
+ self.lock = thread.allocate_lock()
self.init() #call init of inheriting class
# self.__setitem__ = self.argDict.__setitem__
# self.__getitem__ = self.argDict.__getitem__
def init(self):
pass
+ def acquireLock(self):
+ self.lock = thread.allocate_lock() #TODO: fix.
+ self.lock.acquire()
+ def releaseLock(self):
+ self.lock.release()
def className(self):
- return str(self.__class__).split('.')[-1]
+ return str(self.__class__).split('.')[-1] #TODO: this doesn't work.
def __setitem__(self,k, item):
self.argDict[k] = item
def __getitem__(self, item):