[Zope] Sharing global data between threads / locking a method

SER.RI-TIC-Alexis Roda alexis.roda at urv.net
Mon Jun 27 11:35:27 EDT 2005


Jonathan wrote:

> A possible solution:  create a property field on the folder where the 
> external methods are stored.  Have your external method update this 
> property field when the external method starts and again when it exits.  
> This way you can test whether or not the external method is currently in 
> operation.  You could store this property field on a temp_folder for 
> faster performance.

Not sure if this will work. If I understand correctly how does Zope/ZODB 
transaction machinery works, if you set a property on some persistent 
object the change will be visible only after the transaction has been 
commited, wich usually happens at the end of the request, so other 
threads/requests will always get a "long_process_finished" value for the 
property.

Regarding Max M question, a simple solution could be to use a file 
(filesystem, not zope) as lock.



HTH
-- 
                                    ////
                                   (@ @)
----------------------------oOO----(_)----OOo--------------------------
<>               Ojo por ojo y el mundo acabara ciego
/\ Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain)
-----------------------------------------------------------------------



More information about the Zope mailing list