What's the deal with __thread?

Don Clugston dac at nospam.com
Thu Nov 15 06:42:31 PST 2012


On 15/11/12 11:54, Walter Bright wrote:
> On 11/15/2012 2:28 AM, Don Clugston wrote:
>> However, there is one case in the test suite which is unclear to me:
>>
>> extern(C) __thread int x;
>>
>> Is there any other way to do this?
>
> extern(C) int x;
>

What about extern(C) variables which are not thread local?
(which I think would be the normal case).
Then from a C header,

extern(C) int x;

must become:

extern(C) __gshared int x;

in D. It's a very rare case, I guess, but it's one of those situations 
where D code silently has different behaviour from identical C code.


More information about the Digitalmars-d mailing list