> On Sun, Sep 09, 2001 at 10:23:49AM -0700, Doug MacEachern wrote:
> > On Sat, 8 Sep 2001, Barrie Slaymaker wrote:
> >
> > > On a lot of OSs, the cwd is kept as a part of the kernel's per-process
> > > structures, so all threads share the same idea of cwd. Anytime you use
> > > a userland threads package this is likely.
> >
> > we should be able to set things up so chdir() is a noop, and just adjust
> > the enviornent (@INC, $ENV{PATH}, open, etc) to use basename $0 instead of
> > '.'
>
> Looks like ithreads, or at least the win32 subsystem of Perl already
> does this, according to perlfork. If it's not ithreads-general yet
> (haven't had time to spelunk in to find this out), it will need to be on
> most platforms, I think.
I would suspect that this is solved in the perlhost/perlsys code which is win32
specific.
There is nothiing in ithreads that does this. Relevant code is iperlsys.h
PerlDir_chdir.
On unix this is
#define PerlDir_chdir(name) chdir((name))
VMS
# define PerlDir_chdir(n) Chdir(((n) && *(n)) ? (n) : "SYS$LOGIN"))
on windows however (or any other with non implicit sys) it is
(*PL_Dir->pChdir)(PL_Dir, (name))
This probably is where windows does it safe thing. However, should threads have
different cwds? If so it should probably be solved in perl, but can it be done
portable?
How does Apache deal with this?
> > > Then there's APIs that are completely non threadsafe, AFAIK, like
> > > setjmp/longjmp, which are used in Perl in some farily critical places.
> >
> > not an issue according to sarathy..
>
> Thank you for forwarding that, I've not seen it on-list before. Good to
> know.
>
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.
Arthur
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]