[mod_python] Using _global_lock in scripts

Phil Groce pgroce.listserv at gmail.com
Fri Apr 7 14:58:33 EDT 2006

I have a resource which my module will need to access, potentially
from multiple child processes, since I can't directly control the MPM
being used. The logical implementation is to persist the resource to
disk and lock access with a mutex, similarly to what the Session
module does.

Session, of course, does this with _apache._global_lock and
_apache._global_unlock do. However, their names and the names of the
module seem to indicate that the implementors intend for them to be

So I have a few questions:

1. Despite my misgivings at using private interfaces, it would
simplify my life greatly if I could use these functions. Is it
reasonable to assume that, even if they are private, they will exist
and have pretty much the same contract for a while yet? (The seem to
have existed, largely unchanged, for quite a while now.)

2. If it is not reasonable, what suggestions do you have for
implementing concurrent access to a resource from (potentially)
multiple interpreters and/or child processes?

3. If it _is_ reasonable....any chance that this can become a
documented mod_python feature? :)


Phil Groce

More information about the Mod_python mailing list