[RFC] Add pthread_detach_pwd call.

Rich Felker dalias@aerifal.cx
Mon Oct 21 13:59:00 GMT 2013


On Mon, Oct 21, 2013 at 08:37:18AM +0200, Ondřej Bílka wrote:
> On Sun, Oct 20, 2013 at 06:25:05PM -0400, Rich Felker wrote:
> > On Sun, Oct 20, 2013 at 07:41:09PM +0200, Ondřej Bílka wrote:
> > > Hi,
> > > 
> > > One of problematic parts of threading is working directory. As it is
> > > global a changing it is problematic. Particulary when there is a third
> > > party library that does this without multithreading in mind.
> > > 
> > > I got idea how users could fix this without much effort. It is that we
> > > implement a pthread_detach_pwd call which will cause all subsequent
> > > queries/changes in thread be resolved by using thread local variable.
> > > 
> > > Possible disadvantage is that this would make open/fopen more complicated.
> > 
> > There is already a clean, portable way to achieve the exact same
> > thing: the *at functions. Your proposal would have very confusing
> > semantics: for example, when a thread with detached pwd creates a new
> > thread, does the new thread:
> > 
> Could you browse around 50000 open source libaries and rewrite them with
> at functions?

This is a strawman; most libraries have NO REASON WHATSOEVER to care
about the pwd.

Rich



More information about the Libc-alpha mailing list