Commit dc65b97e authored by Jim Fulton's avatar Jim Fulton

Use an event to wait for the thread to start before shutting down.

Also, use a daemonic thread so that the test runner doesn't hand
waiting for the thread to die.
parent 5a760e88
......@@ -13,14 +13,15 @@ class ZODBClientThread(threading.Thread):
def __init__(self, db, test):
threading.Thread.__init__(self)
self._exc_info = None
# self.setDaemon(1)
self.setDaemon(True)
self.db = db
self.test = test
self.event = threading.Event()
def run(self):
conn = self.db.open()
conn.sync()
self.event.set()
time.sleep(15)
# conn.close calls self.transaction_manager.unregisterSynch(self)
......@@ -42,6 +43,7 @@ class ShutdownTest(ZODB.tests.util.TestCase):
def check_shutdown(self):
client_thread = ZODBClientThread(self._db, self)
client_thread.start()
client_thread.event.wait()
# calls conn._release_resources, that calls conn.close(),
# that calls conn.transaction_manager.unregisterSynch(self),
# but from a different thread, so transaction_manager._synchs
......
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