Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Mar 2004 09:13:34 -0500 (EST)
From:      Daniel Eischen <eischen@vigrid.com>
To:        Doug Rabson <dfr@nlsystems.com>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: Thread Local Storage
Message-ID:  <Pine.GSO.4.10.10403300906270.11014-100000@pcnet5.pcnet.com>
In-Reply-To: <200403300935.49999.dfr@nlsystems.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 30 Mar 2004, Doug Rabson wrote:

> On Monday 29 March 2004 23:36, Daniel Eischen wrote:
> > 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. 

It works for libc, since libc knows whether it is threaded
or not.  I think libc is always going to be sort of special,
especially since we seem to need the jump table for the
pthread_* functions to handle the static case.

I'd be in favor of not providing static thread libraries,
but there was too much opposition when I brought it up...

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

-- 
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10403300906270.11014-100000>