[Zope] Re: Locking objects
Tres Seaver
tseaver at zope.com
Thu Jan 13 08:15:33 EST 2005
Jeff Rodriguez wrote:
> I need to lock an object to perform thread/ZEO safe operation on one
> of it's attributes. How can I go about doing this?
The transaction / concurrency machinery of the ZODB makes such
precautions normally unnecessary for persistent objects. Are you
needing to protect a non-persistent object, e.g. a module-level global
data structure? If so, Python's 'threading' module (or the lower-level
'thread' module) is your friend.
See $ZOPE/lib/python/Products/StandardCacheManagers/RAMCacheManager.py
for an example of such usage.
Tres.
--
===============================================================
Tres Seaver tseaver at zope.com
Zope Corporation "Zope Dealers" http://www.zope.com
More information about the Zope
mailing list