Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Mar 2004 10:03:23 -0800
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Doug Rabson <dfr@nlsystems.com>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: Thread Local Storage
Message-ID:  <20040330180323.GA57824@ns1.xcllnt.net>
In-Reply-To: <200403300935.49999.dfr@nlsystems.com>
References:  <Pine.GSO.4.10.10403291718320.29683-100000@pcnet5.pcnet.com> <200403300935.49999.dfr@nlsystems.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 30, 2004 at 09:35:49AM +0100, Doug Rabson wrote:
> > >
> > > I'd quite like to see us use it for stuff like errno, _res and
> > > other uglification currently in libc. Not until the 6.x timeframe
> > > though.
> >
> > I'd like to see libc free of TLS ;-)  The _res stuff can be
> > avoided by modifying the implementation to use thread-safe
> > APIs.  The current _res stuff can _almost_ be eliminated
> > by passing using pthread_getspecific() once and passing
> > the _res around internal APIs.  That's actually a pretty
> > simple change.
> 
> Unfortunately pthread_setspecific() and pthread_getspecific() don't work 
> for non-threaded programs whereas 'int __thread errno' works anywhere. 

Yes. It's also far more optimal.

> It would even work for evil cases where libpthread is loaded after 
> program startup with dlopen.

Yup. I think it's important to have it work.

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040330180323.GA57824>