[Zope] Zope + Python thread safety
lists at simplistix.co.uk
Fri Mar 26 12:15:20 CET 2004
fowlertrainer at anonym.hu wrote:
> Question: the python variable setting/checking is thread-safe ?
Python has Lock objects just like Delphi and C, I'd wrap your setting/checking
code in the same way as you would for Delphi/C...
> I want to set the parameters of Product in only once, but because the
> Zope is threaded app, I must thinking in thread-safe programming methods.
Indeed, Zope and ZODb usually take care of all of this for you, but you're doing
something out of the ordinary, so need to worry aboutit ...
> The code above is thread safe ? (I think, it is not)
> If it is not thread safe, how to set this variable without global
> lock/mutex object ?
You need to put a lock around those bits of code.
> Or how to I set this object's parameters as property, in Designer
> interface of Zope ?
I'd just have them as Zope Properties on your container object, then you don't
need to worry about the threading.
Simplistix - Content Management, Zope & Python Consulting
More information about the Python-list