Commits

Cameron Simpson committed 49a3cf5

cs.threads: locked_property: remove requirement to define _<prop_name>

Comments (0)

Files changed (1)

lib/python/cs/threads.py

     ''' Attempt lockless fetch of property first.
         Use lock if property is unset.
     '''
-    p = getattr(self, prop_name)
+    p = getattr(self, prop_name, unset_object)
     if p is unset_object:
       with getattr(self, lock_name):
-        p = getattr(self, prop_name)
+        p = getattr(self, prop_name, unset_object)
         if p is unset_object:
           ##debug("compute %s...", prop_name)
           p = func(self)