Re: Should the SRFI mandate current-directory per thread?
Sebastien Marie 30 Apr 2020 17:00 UTC
On Thu, Apr 30, 2020 at 03:14:24PM +0300, Lassi Kortela wrote:
> > I just checked what R7RS said about parameters.
> >
> > If an implementation supports multiple threads of execution, then
> > parameterize must not change the associated values of any parameters in
> > any thread other than the current thread and threads created inside
> > ⟨body⟩.
> >
> > If I correctly understand, it means the use of `parameterize' implies a
> > per-thread value (the effect of passing arguments to the procedure returned by
> > `make-parameter', usually for "modification" isn't specified and is
> > implementation dependent).
> >
> > So regarding (1), for consistency with parameter, the working-directory couldn't be
> > a per-process value.
> >
> > And regarding (2), it is per-process value.
>
> Thanks for looking this up - very useful!
>
> It seems there can be several kinds of trouble if the current directory is
> per-process in a multi-threaded implementation. To that end, I would vote to
> require a per-thread cwd parameter unless there are compelling arguments
> otherwise.
This way, you completely discard the point (2) : for POSIX, it is a per-process
value.
Please don't misunderstand: I am not against having per-thread `current-directory'
function. But it can't be defined as it in a srfi named "POSIX API".
Thanks.
--
Sebastien Marie