"
If you really need a global variable you can do
class ThreadSafe(dict):
forever=10**10
def __init__(self):
import thread
self['lock']=thread.allocate_lock()
def __setattr__(self,key,value):
self['lock'].acquire()
self[key]=value
self['lock'].release()
def __getattr__(self,key):
self['lock'].acquire()
value=self[key]
self['lock'].release()
return value
and where you need it use it as:
x=cache.ram('my_thread_safe_object',lambda:ThreadSafe
(),ThreadSafe.forever)
x.value=4
print x.value
If instead you need a backgroud process create one with
python web2py.py -S app -M -R your_backround_process.py
and have the process create (for example) a XMLRPC service to talk to
your apps.
"
this is Massimo's answer from this list, answer for the question I
asked some time ago
it is hard to find, that is why I quote here
--
Kuba
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---