I have a synkronisation script that I run every 10 minutes via wget from
a cron job.
Sometimes the script runs longer than 10 minutes.
In that case I would like to return a page to wget, but not run the
So in a external method/module I have a function like this:
BUSY_STATE = 0
if busy is None:
BUSY_STATE = busy
The idea is that BUSY_STATE is a global value shared between all
threads, and if the sync_test() function below is called while it is
allready running in another thread, it will just return 'Sync allready
I then wrap the actual sync code like this:
def long_test_function(): # just to kill time
t = Timer('Loop time')
for i in xrange(10**7):
d = 7*8
e = 7*8
if not sync_in_progress():
long_test_function() # placeholder for the real sync code
return 'Sync done'
return 'Sync allready in progress'
But it seems that the new method merely waits until the first one has
So it allways returns 'Sync done' and calls long_test_function()
What am I misunderstanding here? Isn't it the right way to share global
data? Or is there some kind of locking going on under my nose that I am
to blind to see.
hilsen/regards Max M, Denmark
IT's Mad Science
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -