Commit 9c1884de authored by Tim Peters's avatar Tim Peters

ClientStorage:

_basic_init():  repair tpc_cond comments in light of recent changes.
tpc_begin:  when self._server is None, do tpc_cond.notify() to let
other threads waiting for "_transaction is None" to continue.
parent ab50500f
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Network ZODB storage client """Network ZODB storage client
$Id: ClientStorage.py,v 1.47 2002/08/16 21:42:49 tim_one Exp $ $Id: ClientStorage.py,v 1.48 2002/08/16 21:58:21 tim_one Exp $
""" """
import cPickle import cPickle
...@@ -114,12 +114,12 @@ class ClientStorage: ...@@ -114,12 +114,12 @@ class ClientStorage:
self.__name__ = name self.__name__ = name
# A ClientStorage only allows one client to commit at a time. # A ClientStorage only allows one client to commit at a time.
# Mutual exclusion is achieved using tpc_cond(), which # Mutual exclusion is achieved using tpc_cond, which
# protects _transaction. A thread that wants to assign to # protects _transaction. A thread that wants to assign to
# self._transaction must acquire tpc_cond() first. # self._transaction must acquire tpc_cond first. A thread
# that decides it's done with a transaction (whether via success
# Invariant: If self._transaction is not None, then tpc_cond() # or failure) must set _transaction to None and do
# must be acquired. # tpc_cond.notify() before releasing tpc_cond..
self.tpc_cond = threading.Condition() self.tpc_cond = threading.Condition()
self._transaction = None self._transaction = None
...@@ -352,6 +352,7 @@ class ClientStorage: ...@@ -352,6 +352,7 @@ class ClientStorage:
# XXX we would have stayed in the while loop. # XXX we would have stayed in the while loop.
assert self._transaction is None assert self._transaction is None
self._transaction = None self._transaction = None
self.tpc_cond.notify()
self.tpc_cond.release() self.tpc_cond.release()
raise ClientDisconnected() raise ClientDisconnected()
......
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