[cfe-dev] status of 'thread_local'

James Gregurich bayoubengal at me.com
Tue Oct 16 13:59:22 PDT 2012


hmmm.   I just ran the test against the 10.7 SDK again and it worked. I'm not sure what I had wrong the first time. 

ok.  "__thread" works for me. I have to encapsulate the implementation anyway as my code currently uses boost::thread_specific_ptr and it must continue to work on 10.6. 




On Oct 16, 2012, at 1:45 PM, Jean-Daniel Dupas <devlists at shadowlab.org> wrote:

> Can you define "does not work" ? 
> 
> I just compiled the following code in C++ mode, and it generate the expected llvm assembly:
> 
> __thread int foo;
> 
> int main(int arcg, char **argv) { return 0; }
> 
> ====== output:
> 
> @foo = thread_local global i32 0, align 4
> 
> define i32 @main(i32 %arcg, i8** %argv) nounwind uwtable ssp {
> entry:
>   %retval = alloca i32, align 4
>> 
> 
> 
> Le 16 oct. 2012 à 22:40, James Gregurich <bayoubengal at me.com> a écrit :
> 
>> Is it C-only? I ran a test with C++ and it didn't work. Does it work with C++ and I need to supply some flag to compiler to enable it? I'll poke around with google and see what info I can dig up.
>> 
>> 
>> 
>> 
>> On Oct 16, 2012, at 1:34 PM, Jean-Daniel Dupas <devlists at shadowlab.org> wrote:
>> 
>>> 
>>> Le 16 oct. 2012 à 21:04, James Gregurich <bayoubengal at me.com> a écrit :
>>> 
>>>> howdy!
>>>> 
>>>> What is the status of 'thread_local' support in clang? is that something that will be delivered in the next few months? later? never will be delivered? has been delivered, but the website not updated?
>>>> 
>>> 
>>> AFAIK, thread locals are supported in C using the __thread keyword on platform that support it for some times (OS X 10.7 for Mach-O, ELF platforms, …).
>>> 
>>> 
>>> -- Jean-Daniel
>>> 
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>> 
> 
> -- Jean-Daniel
> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121016/07ee612b/attachment.html>


More information about the cfe-dev mailing list