Joseph Turian wrote:
See if key is present in root.
[it's not]
Lock key write-access, so that no other client will try to write key.
Compute value for key.
Write value for key.
Unlock key.

Just as an aside, theoretically speaking, checking for the existence of the key should be included in the critical section (the area protected by the lock), otherwise you create a race condition.

Example: process/thread A checks for a key and doesn't find it, A is preempted and process/thread B is scheduled, B checks for the same key and sees that it doesn't exist. B enters the critical section and creates the key. Next, A is scheduled by the OS and enters the critical section and tries to create the same key. Not good.

But as was already explained, all you need to do is check for a conflict.

Cheers,
Izak
_______________________________________________
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