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.

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to