Date: Tue, 3 Aug 2004 09:47:23 -0400 (EDT) From: Daniel Eischen <eischen@vigrid.com> To: Doug Rabson <dfr@nlsystems.com> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/libexec/rtld-elf map_object.c rtld.c rtld.h src/libexec/rtld-elf/amd64... Message-ID: <Pine.GSO.4.10.10408030940090.5981-100000@pcnet5.pcnet.com> In-Reply-To: <1091539451.1988.27.camel@builder02.qubesoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 3 Aug 2004, Doug Rabson wrote: > On Tue, 2004-08-03 at 09:51, Doug Rabson wrote: > > dfr 2004-08-03 08:51:00 UTC > > > > FreeBSD src repository > > > > Modified files: > > libexec/rtld-elf map_object.c rtld.c rtld.h > > libexec/rtld-elf/alpha reloc.c rtld_machdep.h > > libexec/rtld-elf/amd64 reloc.c rtld_machdep.h > > libexec/rtld-elf/i386 reloc.c rtld_machdep.h > > libexec/rtld-elf/ia64 reloc.c rtld_machdep.h > > libexec/rtld-elf/sparc64 reloc.c rtld_machdep.h > > Added files: > > libexec/rtld-elf rtld_tls.h > > Log: > > Add support for Thread Local Storage. > > Thread Local Storage is a gcc feature which allows you to add a > '__thread' modifier to the declaration of global and static variables. > This extra modifier means that the variable's value is 'thread local', > i.e. one thread changing its value will not affect any other thread. In > lots of ways its similar to the per-cpu variables we use in the kernel. > > Most of the support is in the dynamic linker which discovers the TLS > blocks in each shared libary and allocates memory for them. It provides > hooks for threading libraries to allocate and initialise TLS blocks for > each new thread and hooks which the compiler uses to resolve the address > of a TLS variable. > > The main user for this right now is the OpenGL api. In OpenGL, each > thread has a GL context object associated with it. Each call to a GL > function implicitly references this context object. For single-threaded > OpenGL, the context can be found by e.g. a global variable but for > thread-safe OpenGL, the most efficient mechanism is to use TLS. This is > how the NVidia OpenGL driver supports threading and the open source > OpenGL drivers will use TLS in the future as well. > > As far as FreeBSD goes, there is nothing in the system right now that > uses TLS. Its possible that we might use TLS for 'errno' and similar > things in the 6.0 timeframe. And well-designed APIs shouldn't need TLS, so don't abuse it ;-) It is most useful for existing APIs that can't be made thread-safe and where speed is important. -- Dan Eischen
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10408030940090.5981-100000>