|
Graham Dumpleton
grahamd at dscpl.com.au
Sat Apr 29 00:07:05 EDT 2006
On 29/04/2006, at 1:44 PM, yjfuk wrote:
>
> what does it mean that you say 'defined at the module level '?
Same as saying "global" variable within a module.
Your code was:
test=0
def a(req):
global test
req.write(str(test))
test=test+1
def b(req):
global test
req.write(str(test))
test=test+1
The "test" variable is "global" within that module, or as Jim
described it,
it is "defined at the module level".
For a handler module, this is important because where you are using a
multithreaded
MPM, concurrent requests can be trying to access the same data at the
same time.
Access to such data therefore must be thread safe. There are also
other issues in
mod_python that may have to be contended with if module reloading is
enabled.
Graham
|