28 Aug
2000
28 Aug
'00
3:10 p.m.
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.