> > However, should threads have different cwds?
> 
> Well, if you want to use any modules that chdir() in threaded code, I
> think so.  Basically, in a threaded perl, unsafe chdir should be warned
> about or perl should DWIM and emulate chdir per thread (as it does on
> windows).  The former is the halting problem, I think ;-).
> 
> > If so it should probably be solved in perl, but can it be done portable?
> 
> Don't see why not.  The real oddity here is Windows which has a cwd per
> volume (A:, B:, etc), and that's either ignored in win32.c or emulated
> too, not sure.



> > How does Apache deal with this?
> 
> By carefully repeating "Don't Do That" as they code the httpd ;-).  The
> cgi-bin chdir() is done after fork()ing, and most (if not all, not sure)
> other chdir()s are pre-thread-startup or when coredumping.

There are good reasons for this :-)

> There was an ap_ chdir() wrapper in existance for a while, but that was
> removed becuase it wasn't threadsafe and not in use.
> 
> That all being said, chdir() is probably in use in various Apache
> modules here and there; they'll need a bit of porting for any OS other
> than Linux, I suspect, and perhaps even on Linux (don't know if the cwd
> is part of the process structures that is shared or not, need to spelunk
> & test, unless somebody here knows...).

I would suspect linux has a process level chdir, not sure thou.

> > Sarathy claims that all stjmp/longjmp code is exeucted while not
> > holding any mutexes, so it should be threadsafe. One can note that
> > setjmp and longjmp are not non-mt safe.  But they can be used to do
> > unsafe things.
> 
> Or they can be used in a safe manner, such as never jumping between
> threads.  setjmp() and longjmp() should be safely usable.  Is the only
> interaction with mutexes that you need to release any acquired after the
> setjmp() before calling longjmp()?
> 
> - Barrie

Yes, as far as I can tell.

Arthur


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to