DMD-MAC!!

Fawzi Mohamed fmohamed at mac.com
Sat Jan 31 05:59:54 PST 2009


On 2009-01-29 23:19:25 +0100, Walter Bright <newshound1 at digitalmars.com> said:

> Sean Kelly wrote:
>> There are pthread calls for TLS which are implemented for OSX.  But 
>> however it works (I haven't looked into it), it likely isn't as 
>> efficient or easy to deal with as the __thread storage class on other 
>> OSes.
> 
> It won't be as efficient. But that really doesn't matter at this point 
> - accessing global variables in a tight loop is a bad idea anyway. TLS 
> just has to work. It can be optimized later as OSX improves (which it 
> must, as TLS is going to be a bigger and bigger deal as time goes on).

I don't agree so much with this, TLS can be useful is some occasions 
but should be used very sparingly in my opinion, it should be used 
mostly for the infrastructure, not by the end user.

TSL is an evolution of global variables and still has many of their 
drawbacks, if possible one should pass the variables explicitly, often 
with some care, and maybe grouping them into structure it turns out to 
be easier than one thinks, and the effort costs little typing.

There are things where TSL can be very useful, and I use it for example 
to make the scheduling interface nicer, but I think that with good 
design those cases are few...

Encouraging wide use of TSL is bad in my opinion (not that you are 
doing it, but one might interpret it like that).

Fawzi



More information about the Digitalmars-d-announce mailing list