[Zope-dev] Threads, Locks, Volatility, and Angst

Christian Theune ct at gocept.com
Thu Apr 1 08:58:54 EST 2004


On Thu, 2004-04-01 at 00:25, Ian Beatty wrote:
> 
> I thought "Okay, no problem. I'll just make the lock variable volatile,
> since I don't really care whether it persists when Zope shuts down." So I
> renamed the lock to begin with '_v_'. That solves my "UnpickleableError"
> problem nicely. Unfortunately, it introduces a different problem: the code
> that calls acquire() on the lock now throws "AttributeError: 'NoneType'
> object has no attribute 'acquire'". I'm sure I initialize that variable to a
> threading.Lock() in the object's __init__ method. So now I'm worried that
> Zope is doing all kinds of pickling-unpickling activity behind the scenes,
> and anything I have that's volatile can disappear without warning.

I'm not sure about this right now, but iirc _v_ attributes are not
stored until "zope shutdown" but until the object is reloaded from the
ZODB (for whatever reason it went out of the cache). This basically
means no availability longer than until the end of one request can be
guaranteed.

Christian

-- 
Christian Theune, gocept gmbh & co. kg
http://www.gocept.com - ct at gocept.com
fon: 03496 3099112 fax: 03496 3099118 mobile: 0179 7808366
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20040401/9e48c73d/attachment.bin


More information about the Zope-Dev mailing list