diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-06-26 19:51:01 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-06-26 19:51:01 +0000 |
| commit | 9dd15963d36edd1989e108a817acb8ee5cfd2401 (patch) | |
| tree | 184a52090f44b9ae7c8ec2126ef32c2bebb64c0d /lib/sqlalchemy/pool.py | |
| parent | e2fc1a36d30eae0139a888365f2c25d16b14ce1e (diff) | |
| download | sqlalchemy-9dd15963d36edd1989e108a817acb8ee5cfd2401.tar.gz | |
migrated Queue.Queue to its own module here, to assure RLock compatibility
Diffstat (limited to 'lib/sqlalchemy/pool.py')
| -rw-r--r-- | lib/sqlalchemy/pool.py | 15 |
1 files changed, 3 insertions, 12 deletions
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 |
