[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Databases &/or binary data



Quoting "Paul A. Steckler":
> I did this once for gdbm and it worked perfectly except that I had to pass 
> an absolute filename to gdbm because it's idea of the current directory was 
> not mzscheme's idea.
> I remember having this problem in other contexts also, does anybody have an 
> idea what might be wrong?

Yes: MzScheme has it's own notion of current directory because the
current directory is thread-specific (via a parameter).


When MzScheme is compiled to use OS-implemented threads, MzScheme
*can't* use the OS notion of current directory, because it is
process-specific instead of thread-specific. (As far as I can tell,
that means that the notion of current directory is useless to
multi-threaded C programs.)

If MzScheme uses it's own threads, it still turns out to be easier and
more efficient to use MzScheme's own notion of the current directory.
Also, if MzScheme is embedded in a multi-threaded program, where
MzScheme only sees one OS thread, then MzScheme is less likely to hurt
other threads if they happen to use the current directory (but see the
comment above).


FWIW, the MzScheme function
  int scheme_os_setcwd(char *buf, int noexn);
sets the OS-level current directory. MzScheme itself uses this function
to implement primitives like `process'.

Matthew