Re: Thread Local Storage

From: Casper H.S. Dik (Casper.Dik_at_Sun.COM)
Date: 01/31/05


Date: 31 Jan 2005 13:17:03 GMT

William Ahern <william@wilbur.25thandClement.com> writes:

>Markus Gyger <markus+news@gyger.org> wrote:
>> Gianni Mariani writes:
>> > What I'd like
>> > to see is a another section in executable files that are thread specific
>> > and a keyword when declaring a variable that would be placed in a thread
>> > specific section.
>>
>> Sun Studio compilers on Solaris support a __thread specifier:
>> http://docs.sun.com/source/819-0494/sun.specific.html#46507
>> http://docs.sun.com/doc/817-1984/6mhm7pl2b?a=view
>> http://docs.sun.com/coll/771.6 http://docs.sun.com/coll/45.20

>As does any recent Linux/glibc/GCC environment:

>static int __thread local_index;
>/* On creation every thread gets its own local_index, initialized to 0. */

>With __thread, we've come full circle. All those non-thread safe functions
>which used static internal state are reborn. The cumbersome per-thread
>initialization is handled by the linker and the threading library, just like
>it should be. What took so long!?

Strangely enough, a feature like this existed in the initial Solaris
threads paper from early Solaris days. It was never fully implemented
(it used a #pragma ...)

Casper

-- 
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.


Relevant Pages

  • Re: md5
    ... some changes but it also needed to retain binary compatibility. ... it's not the default and not possible on Solaris 2.5.1 and before. ... Expressed in this posting are my opinions. ... to opinions held by my employer, Sun Microsystems. ...
    (comp.unix.solaris)
  • Re: Which Sun Blade?
    ... Just be aware that the box will consume a bit of power, ... Make sure it runs Solaris and that Solaris is running picld; ... Expressed in this posting are my opinions. ... to opinions held by my employer, Sun Microsystems. ...
    (comp.sys.sun.hardware)
  • Re: strange behaviour of library in static initialization context
    ... >Linux, FreeBSD, NetBSD and MacOSX, without any problems. ... not limited to Solaris. ... Expressed in this posting are my opinions. ... to opinions held by my employer, Sun Microsystems. ...
    (comp.unix.solaris)
  • Re: gethostans: buffer overflow exploit on solaris / sendmail
    ... >sendmail on solaris 9. ... >possible attempt to exploit buffer overflow while looking up mail.xxx.be ... Expressed in this posting are my opinions. ... to opinions held by my employer, Sun Microsystems. ...
    (comp.unix.solaris)
  • Re: Is there a "Three Strikes" lockout feature that can be used on Solaris 8?
    ... with Y number of Capital letters, ... standard available as of Solaris 10; ... Expressed in this posting are my opinions. ... to opinions held by my employer, Sun Microsystems. ...
    (comp.unix.solaris)