shared vs __gshared

Sergei Nosov sergei.nosov at gmail.com
Mon Jun 10 19:33:03 PDT 2013


Thank you for answers. Let me check if I got this right.

On Monday, June 10, 2013 13:23:26 Steven Schveighoffer wrote:
> shared was supposed to infer memory barriers, but AFAIK, it 
> doesn't do
> that. Not sure it ever will.

So, my first impression about what shared should do (no low-level 
races at all) was correct, but the things didn't work out that 
way. So that kind of doesn't solve the issue with low-level 
races, which IIRC Andrei considers the biggest crime a language 
type system can commit. And the likely (brand-new) solution to 
that is

On Monday, 10 June 2013 at 14:49:27 UTC, Dmitry Olshansky wrote:
> Now there was a discussion on it recently which indicates that 
> shared data might lose it's built-in ops to prevent confusion 
> and require folks to just use core.atomic directly for 
> lock-free or alternatively cast+mutex for lock-based.

which seems reasonable too.

So, is my understanding correct? If yes, why the path with memory 
barriers was "announced", but not taken?


More information about the Digitalmars-d-learn mailing list