[Zope-dev] Transaction question
Chris McDonough
chrism@digicool.com
Mon, 28 Aug 2000 11:10:46 -0400
Using a mutex by way of example, without using anything Zope-specific
(the following uses the Python threading module):
import threading
lock = threading.Lock()
myglobal = []
def changeglobal(val):
lock.acquire()
try:
myglobal.append(val)
finally:
lock.release()
> > (I suppose class attributes needs to be protected to be thread-safe?
> > Does anybody have an example how to do that?)
>
> You can use allocate_lock() to accomplish thread safety with class
> attributes.