On Wed, Aug 10, 2011 at 6:45 AM, dsh <daniel.hais...@googlemail.com> wrote:
> Hi Jean-Sebastien,
>
> On Wed, Aug 10, 2011 at 6:45 AM, Jean-Sebastien Delfino
> <jsdelf...@apache.org> wrote:
>>
>> That's what I meant when I mentioned 'convert usages of __thread to
>> Posix thread TLS calls' in my previous post [1].
>>
>> __thread works for me with GCC on Mac OS X (using the GCC build from
>> the HPC project [2]), but causes a compile error with Clang/LLVM. It's
>> listed as a limitation of Clang on Mac OS X in the Clang user manual
>> (look for __thread on this page [3]).
>>
>
> Does "Works for me" mean it compiles for you just fine AND during
> runtime you are getting the expected behavior or does it just mean the
> code compiles just fine if using GCC?
>
> I am asking cause I googled a bit last night and from what I found I
> had the feeling thread local isn't really supported on OS X during
> runtime.
>

Hi Daniel!

__thread compiles and behaves as expected for me on OS X with GCC 4.6
(the version referenced in the macos/macos-install script).

I've added some test logic to kernel/parallel-test.cpp to help verify
that (see SVN r1156460).

Parallel-test built with GCC works, showing that __thread is correctly
implemented by GCC on OS X.

After commenting __thread on parallel-test.cpp:line 134, parallel-test
breaks with an assertion error, showing that the test is actually
effective at testing thread local storage.

I'm hoping that this additional test code will help you when you
implement thread local storage over the pthread API. In the meantime
you don't have to worry about it if you --disable-threads :)

-- 
Jean-Sebastien

Reply via email to