[ZODB-Dev] Thread Safety, Reaimed
Stefan H. Holek
stefan at epy.co.at
Thu Aug 7 21:19:35 EDT 2003
Hm, then try a Borg pattern, maybe.
# Module GlobalLock.py
import threading
class GlobalLock:
__shared_state = {
'_lock': threading.Lock()
}
def __init__(self):
self.__dict__ = self.__shared_state
def acquire(self):
self._lock.acquire()
def release(self):
self._lock.release()
Now you can do things like:
from GlobalLock import GlobalLock
GlobalLock().acquire()
...
GlobalLock().release()
HTH,
Stefan
--On Donnerstag, 07. August 2003 10:44 -0700 "Norfleet, Sheppard S."
<sheppard.norfleet at ngc.com> wrote:
> Stefan,
>
> Thanks for the response.
>
> I tried that, but I get an UnboundLocalError when I try to reference the
> lock from the Zope Object.
>
> Regards,
>
> Shep
>
--
The time has come to start talking about whether the emperor is as well
dressed as we are supposed to think he is. /Pete McBreen/
More information about the ZODB-Dev
mailing list