SVN: ZODB/trunk/src/ZODB/BaseStorage.py Make lock non-private so subclasses can use it with with.

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20100205215500.5F6F0941AF__40270.8266898573$1265406928$gmane$org@cvs.zope.org>
Log message for revision 108804:
  
  Make lock non-private so subclasses can use it with with.
  

Changed:
  U   ZODB/trunk/src/ZODB/BaseStorage.py

-=-
Modified: ZODB/trunk/src/ZODB/BaseStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/BaseStorage.py	2010-02-05 21:54:21 UTC (rev 108803)
+++ ZODB/trunk/src/ZODB/BaseStorage.py	2010-02-05 21:54:59 UTC (rev 108804)
@@ -83,12 +83,12 @@
         log.debug("create storage %s", self.__name__)
 
         # Allocate locks:
-        self.__lock = threading.RLock()
+        self._lock = threading.RLock()
         self.__commit_lock = threading.Lock()
 
         # Comment out the following 4 lines to debug locking:
-        self._lock_acquire = self.__lock.acquire
-        self._lock_release = self.__lock.release
+        self._lock_acquire = self._lock.acquire
+        self._lock_release = self._lock.release
         self._commit_lock_acquire = self.__commit_lock.acquire
         self._commit_lock_release = self.__commit_lock.release
 
@@ -114,7 +114,7 @@
         f = sys._getframe(1)
         sys.stdout.write("[la(%s:%s)\n" % (f.f_code.co_filename, f.f_lineno))
         sys.stdout.flush()
-        self.__lock.acquire(*args)
+        self._lock.acquire(*args)
         sys.stdout.write("la(%s:%s)]\n" % (f.f_code.co_filename, f.f_lineno))
         sys.stdout.flush()
 
@@ -122,7 +122,7 @@
         f = sys._getframe(1)
         sys.stdout.write("[lr(%s:%s)\n" % (f.f_code.co_filename, f.f_lineno))
         sys.stdout.flush()
-        self.__lock.release(*args)
+        self._lock.release(*args)
         sys.stdout.write("lr(%s:%s)]\n" % (f.f_code.co_filename, f.f_lineno))
         sys.stdout.flush()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.