[cfe-dev] __thread keyword, LLVM 3.2 & Xcode 4.6

Seth Cantrell seth.cantrell at gmail.com
Tue Nov 6 15:47:21 PST 2012


On Nov 6, 2012, at 4:04 AM, Jean-Daniel Dupas <devlists at shadowlab.org> wrote:

> 
> Le 6 nov. 2012 à 01:37, James Gregurich <bayoubengal at me.com> a écrit :
> 
>> hi.
>> 
>> I just updated to Xcode 4.6.  I note the following:
>> 
>> 
>> $ /Applications/Xcode46-DP1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --version
>> Apple clang version 4.2 (tags/Apple/clang-424.0.11) (based on LLVM 3.2svn)
>> Target: x86_64-apple-darwin12.2.0
>> Thread model: posix
>> 
>> 
>> It is my understanding from the release notes, that LLVM 3.2 is support thread-local storage. I just re-ran my test using the '__thread' keyword from the last time I asked about this and I still just get one instance of the object rather than one-per-thread.
> 
> 
> The __thread keyword is a C extension (it not part of the standard). Using it with C++ as is even less specified than using it with C.
> 
> Moreover, it has already be specified in the previous discussion that supporting C++ TLS required OS support. Updating Xcode does not change that. 
> 

gcc 4.8 now implements thread_local with a performance penalty for global thread_local variables: http://gcc.gnu.org/gcc-4.8/changes.html#cxx

I guess that function-local thread_local variables can use the same scheme for initialization as function-local static variables.


> -- Jean-Daniel
> 
> 
> 
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list