On 09.10.2006, at 17:40, Tres Seaver wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Christian Zagrodnick wrote:
Hi there,

the DB.open method makes me wonder how it works
(http://svn.zope.org/ZODB/trunk/src/ZODB/DB.py?rev=69551&view=auto)

It locks with self._a() and calls self._connectionMap which locks too. I
cannot imagine a way this could possibly work.

I guess the lock should be released before the _connectionMap call?

Interestingly both all the tests pass and ZODB works...

Note the following in the __init__()::

        # Allocate lock.
        x = threading.RLock()
        self._a = x.acquire
        self._r = x.release

The lock is a "reentrant" lock[1], which means that subsequent locks
from within the same thread do not deadlock;  instead, they increment
the lock count.

[1] http://docs.python.org/lib/module-threading.html#l2h-3418


Right. *removing blindfold* This explains something :) Thanks for the note.


Actually I came to that lock while investigating Ape for ZODB 3.6 where it in some way actually *did* lock. But I'll investigate that later.


--
Christian Zagrodnick

gocept gmbh & co. kg  ·  forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891




Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to