From 9dd15963d36edd1989e108a817acb8ee5cfd2401 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 26 Jun 2006 19:51:01 +0000 Subject: migrated Queue.Queue to its own module here, to assure RLock compatibility --- lib/sqlalchemy/pool.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'lib/sqlalchemy/pool.py') diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index 420e41247..0a5b5ca2a 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -10,15 +10,14 @@ on a thread local basis. Also provides a DBAPI2 transparency layer so that pool be managed automatically, based on module type and connect arguments, simply by calling regular DBAPI connect() methods.""" -import Queue, weakref, string, cPickle -import util, exceptions +import weakref, string, cPickle +from sqlalchemy import util, exceptions +import sqlalchemy.queue as Queue try: import thread - import threading except: import dummythread as thread - import dummythreading as threading proxies = {} @@ -210,14 +209,6 @@ class QueuePool(Pool): self._creator = creator self._pool = Queue.Queue(pool_size) - # modify the pool's mutex to be an RLock. this is because a rare condition can - # occur where a ConnectionFairy's __del__ method gets called within the get() method - # of the Queue (and then tries to do a put() within the get()), causing a re-entrant hang. - # the RLock allows the mutex to be reentrant within that case. - self._pool.mutex = threading.RLock() - self._pool.not_empty = threading.Condition(self._pool.mutex) - self._pool.not_full = threading.Condition(self._pool.mutex) - self._overflow = 0 - pool_size self._max_overflow = max_overflow self._timeout = timeout -- cgit v1.2.1