A Refcounted Array Type

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 26 20:13:01 PST 2015


On 2/26/15 10:56 PM, ketmar wrote:
> On Thu, 26 Feb 2015 21:56:30 -0500, Steven Schveighoffer wrote:

>> I can't see a situation where this would be what you wanted. Accessing
>> global data should be fine, but thread-local data is not.
>
> let's assume that i have a program that has only one thread. i know it
> for sure. and i don't like prepending ugly `__gshared` to my declarations.

In that case, you shouldn't be subject to any kind of race conditions. 
But we can't make the library/language based on this assumption. Your 
case is the exceptional case.

I think it's going to be difficult to impossible to prevent people from 
using TLS in destructors anyway. It can probably be a guideline more 
than a compiler error.

-Steve


More information about the Digitalmars-d mailing list