Commit 44eac704 authored by Jim Fulton's avatar Jim Fulton

Use Lock from utils, rather than threading to ease future debugging

parent e9c4ca40
...@@ -6,12 +6,10 @@ and start time and moves it into a storage adapter. This allows ZODB ...@@ -6,12 +6,10 @@ and start time and moves it into a storage adapter. This allows ZODB
to treat Relstoage and other storages in pretty much the same way and to treat Relstoage and other storages in pretty much the same way and
also simplifies the implementation of the DB and Connection classes. also simplifies the implementation of the DB and Connection classes.
""" """
import threading
import zope.interface import zope.interface
from . import interfaces, serialize, POSException from . import interfaces, serialize, POSException
from .utils import p64, u64 from .utils import p64, u64, Lock
class Base(object): class Base(object):
...@@ -61,7 +59,7 @@ class MVCCAdapter(Base): ...@@ -61,7 +59,7 @@ class MVCCAdapter(Base):
def __init__(self, storage): def __init__(self, storage):
Base.__init__(self, storage) Base.__init__(self, storage)
self._instances = set() self._instances = set()
self._lock = threading.Lock() self._lock = Lock()
if hasattr(storage, 'registerDB'): if hasattr(storage, 'registerDB'):
storage.registerDB(self) storage.registerDB(self)
...@@ -121,7 +119,7 @@ class MVCCAdapterInstance(Base): ...@@ -121,7 +119,7 @@ class MVCCAdapterInstance(Base):
def __init__(self, base): def __init__(self, base):
self._base = base self._base = base
Base.__init__(self, base._storage) Base.__init__(self, base._storage)
self._lock = threading.Lock() self._lock = Lock()
self._invalidations = set() self._invalidations = set()
self._start = None # Transaction start time self._start = None # Transaction start time
self._sync = getattr(self._storage, 'sync', lambda : None) self._sync = getattr(self._storage, 'sync', lambda : None)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment