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? -- Jeffrey Alan Rodriguez Jeffrey.Rodriguez@gmail.com
--On Mittwoch, 12. Januar 2005 14:02 Uhr -0700 Jeff Rodriguez <jeffrey.rodriguez@gmail.com> 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?
Please describe the scenario where you need that. -aj
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@zope.com Zope Corporation "Zope Dealers" http://www.zope.com
participants (3)
-
Andreas Jung -
Jeff Rodriguez -
Tres Seaver