DIP80: phobos additions

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 11 05:17:02 PDT 2015


On 6/11/15 4:15 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm at gmx.net>" 
wrote:
> On Wednesday, 10 June 2015 at 20:31:52 UTC, Steven Schveighoffer wrote:
>> OK, thanks for the explanation. I'd do it the other way around:
>> Flag!"threadlocal", since we should be safe by default.
>
> `RefCounted!T` is also thread-local by default, only
> `shared(RefCounted!T)` needs to use atomic operations.

I may have misunderstood Andrei. We can't just use a flag to fix this 
problem, all allocations are in danger of races (even thread-local 
ones). But maybe he meant *after* we fix the GC we could add a flag? I'm 
not sure.

A flag at this point would be a band-aid fix, allowing one to optimize 
if one knows that his code never puts RefCounted instances on the heap. 
Hard to prove...

-Steve


More information about the Digitalmars-d mailing list