aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2011-02-14 01:51:43 -0500
committerGravatar rcoh <rcoh@mit.edu>2011-02-14 01:51:43 -0500
commit83242972c09032eb89dd547f3ff3c4dcc2693555 (patch)
tree62fdb611afbb37ff90f0356cac5828f48ec50f60 /util
parent9c76b22071259fe8195eaf5bd846219fc2cade4d (diff)
Fixed some threading bugs. Modified LightInstallation.py so that Behaviors are *Only* run if they
are marked to be rendered. Fixed a threading issue tied to the component registry.
Diffstat (limited to 'util')
-rw-r--r--util/ComponentRegistry.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/util/ComponentRegistry.py b/util/ComponentRegistry.py
index be913df..3036138 100644
--- a/util/ComponentRegistry.py
+++ b/util/ComponentRegistry.py
@@ -1,12 +1,18 @@
import pdb
import hashlib
from logger import main_log
+import thread
#TODO: make component registry a singleton
def initRegistry():
#TODO: don't overwrite existing registry
if not 'Registry' in globals():
globals()['Registry'] = {}
-
+ makelock()
+
+
+def makelock():
+ global utilLock
+ utilLock = thread.allocate_lock()
def clearRegistry():
initRegistry()
@@ -14,6 +20,9 @@ def removeComponent(cid):
global Registry
Registry.pop(cid)
+def getLock():
+ global utilLock
+ return utilLock
def getComponent(cid):
global Registry
return Registry[cid]
@@ -31,6 +40,8 @@ def registerComponent(component, cid=None):
cid = getNewId()
component['Id'] = cid
main_log.debug(cid + 'automatically assigned')
+ if cid in Registry:
+ import pdb; pdb.set_trace()
Registry[cid] = component
return cid
@@ -42,10 +53,6 @@ def removeComponent(cid):
global Registry
Registry.pop(cid)
-def getComponent(cid):
- global Registry
- return Registry[cid]
-
def getNewId():
global Registry
trialKey = len(Registry)