[mod_python] Re: Another threading issue: chdir (fwd)

Stéphane BIDOUL SBID at BXS.BE
Fri Jun 9 09:23:29 EST 2000


> Having the url directory as your current directory is just an intuitive
> thing and makes it easier for the developer.... E.g. if you're trying to
> open files, etc.

Agreed. OTOH, it is quite easy to obtain the module directory
with something like os.path.dirname(__file__).

> One thing that we could do is restore the original directory and make sure
> that the lock is aqcuired before first chdir() and after the last chdir()?

It would require another lock than the global interpreter lock because
that one can be released during execution. If another thread steps
in a that moment, the current directory could change in the middle of
a script...

But then it would degrade even native handlers to single-threading.

> Or chdir could be made optional via a directive of some sort.... I need to
> think about this too...

This option looks reasonable to me; 
the associated threading caveats could be documented easily.

Cheers

-sbi
sbi at acse.be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.modpython.org/pipermail/mod_python/attachments/20000609/a0168ad8/attachment-0003.htm


More information about the Mod_python mailing list