Is D right for me?

Jacob Carlborg doob at me.com
Wed Oct 13 03:41:00 PDT 2010


On 2010-10-13 07:17, Walter Bright wrote:
> Denis Koroskin wrote:
>> Either way, it needs some language support, because currently TLS
>> implemented on compiler level rather than library level. I proposed
>> this change in past, but no one responded.
>
> Using TLS needs operating system support, and there's special linker
> support for it and the compiler has to generate TLS references in
> certain ways in order for it to work.
>
> There is no such support in OSX for TLS, and it is done manually by the
> library. However, TLS access is 10 times slower than on Linux/Windows.
>
> Without doing TLS in the operating system standard way, you tend to get
> hosed if you link with a shared library/DLL that has TLS.

I don't know how you have implemented TLS on Mac OS X but it does 
support TLS via the Posix API pthreads. This is the only page from 
Apple's documentation I could find for now (I'm certain I've seen a 
better page) 
http://developer.apple.com/macosx/multithreadedprogramming.html .

According to these: 
http://lifecs.likai.org/2010/05/mac-os-x-thread-local-storage.html and 
http://lists.apple.com/archives/darwin-dev/2005/Sep/msg00005.html the 
implementation of TLS in the Posix API on Mac OS X should be as fast as 
the EFL implementation. As the blog post mentions, there is an inline 
version of pthread_getspecific. I also have to add that I have no idea 
if the pthreads can be used to implement TLS in the compiler.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list