shared vs __gshared
Steven Schveighoffer
schveiguy at yahoo.com
Mon Jun 10 10:23:26 PDT 2013
On Mon, 10 Jun 2013 09:38:43 -0400, Sergei Nosov <sergei.nosov at gmail.com>
wrote:
> Hi!
>
> I'm puzzled with what's the difference between shared and __gshared.
shared is part of the type, __gshared is not.
The danger of __gshared is that the compiler treats it as if it were not
shared. You better know what you are doing, lots of code expects that
anything not marked as shared is thread-local.
shared was supposed to infer memory barriers, but AFAIK, it doesn't do
that. Not sure it ever will.
-Steve
More information about the Digitalmars-d-learn
mailing list