# HG changeset patch # User Pierre-Yves David # Date 1363979083 -3600 # Node ID cdb261bd36ac25ec1e96cf24d4a7054bf79ac7e5 # Parent 3d932eec0bda9b65d5e4273ee7c7ad02d4447800 [session] make session lock reentrant We are going to use it for other session related business. It is renamed from _closed_lock to _lock in the same move. diff -r 3d932eec0bda -r cdb261bd36ac server/session.py --- a/server/session.py Fri Mar 22 19:51:50 2013 +0100 +++ b/server/session.py Fri Mar 22 20:04:43 2013 +0100 @@ -388,7 +388,7 @@ self.__threaddata = threading.local() self._threads_in_transaction = set() self._closed = False - self._closed_lock = threading.Lock() + self._lock = threading.RLock() def __unicode__(self): return '' % ( @@ -861,7 +861,7 @@ def set_cnxset(self): """the session need a connections set to execute some queries""" - with self._closed_lock: + with self._lock: if self._closed: self.free_cnxset(True) raise Exception('try to set connections set on a closed session %s' % self.id) @@ -1153,7 +1153,7 @@ def close(self): """do not close connections set on session close, since they are shared now""" - with self._closed_lock: + with self._lock: self._closed = True # copy since _threads_in_transaction maybe modified while waiting for thread, cnxset in self._threads_in_transaction.copy():