Concurrency, I guess
davidschein at alumni.tufts.edu
Fri Jan 20 10:35:21 EST 2006
I have a simple intranet web app whose job is to synchronize a couple of
databases. The web part is that you can change settings such as how often the
sync should happen, force the sync, or see the log. Since it runs periodically,
I want the process that does the db sync to run happily along but be aware of
when a setting is changed. So in my simple mind I envision 2 threads: start the
sync process, start the web server and hope that when the web server handles
some request and changes a setting, the sync process knows about it. The final
requirement is that the server can know if the sync process is running already
should someone try to manually start the sync.
Anyway, I have tried messing around with the threading module and referenced
some examples I have come across, but to no avail. Fundamentally I expected
that when I change a global variable in 1 thread, the new value would be picked
up in any other thread. This does not appear to be the case. (I understand that
there are lots of potential issues with this but only 1 thread ever shanges the
value anyhow.) I have not even tried blocking the sync process if it is already
The candygram module (http://candygram.sourceforge.net/) might be the way for me
to go, but I would still like to understand this pretty basic question. So any
insight, advice, or references on the problem as described would be very
welcome. It seems it must be fairly common.
Peace, David S.
More information about the Python-list