Re: Thread Local Storage
From: Casper H.S. Dik (Casper.Dik_at_Sun.COM)
Date: 01/31/05
- Next message: Frederick Bruckman: "Re: Interesting problem with Serial Port"
- Previous message: Alex Fraser: "Re: How can I make all child processes die with the parent?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Next message: Frederick Bruckman: "Re: Interesting problem with Serial Port"
- Previous message: Alex Fraser: "Re: How can I make all child processes die with the parent?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|