thread-local storage
Posted: Thu Jul 31, 2003 7:26 am
according to the latest "info gcc", it looks like gcc 3 now has a "per thread" class storage, called "__thread" that can be used to allocate thread-specific variables, which come very handy when doing multithreaded library programming (and do not wish to meddle with reentrant functions problems)
i've not yet read through it, but i've no information about TLS for COFF binaries so far ...
more informations about this new (?) feature may be found in GCC "info" pages, and informations about how it is implemented with ELF output files can be found at http://people.redhat.com/drepper/tls.pdf
An object whose identifier is declared with the storage-class
specifier `__thread' has "thread storage duration". Its
lifetime is the entire execution of the thread, and its
stored value is initialized only once, prior to thread
startup.
The `__thread' specifier shall be used only with variables.
i've not yet read through it, but i've no information about TLS for COFF binaries so far ...