What's the deal with __thread?

Don Clugston dac at nospam.com
Thu Nov 15 02:28:55 PST 2012


On 14/11/12 23:16, Walter Bright wrote:
> On 11/14/2012 12:06 PM, Sean Kelly wrote:
>> On Nov 14, 2012, at 6:26 AM, Don Clugston <dac at nospam.com> wrote:
>>
>>> IIRC it was used prior to 2.030. In the spec, it is in the keyword list,
>>> and it's also listed in the "Migrating to shared" article. That's all.
>>> There are a small number of uses of it in the DMD test suite.
>>>
>>> Is it still valid? Is it useful? Or has everyone forgotten that it still
>>> exists?
>>
>> I think __thread was for explicit TLS before TLS became the default.
>> I don't
>> see a continued use for it.
>>
>
> Sean's right.

Good, that's what I thought. Lets remove it from the spec, and deprecate 
it. There is probably no extant code that uses it, outside of the test 
suite.

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?




More information about the Digitalmars-d mailing list