New to D - playing with Thread and false Sharing
John Colvin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 21 02:10:04 PDT 2015
On Friday, 21 August 2015 at 02:44:50 UTC, Rikki Cattermole wrote:
> On 8/21/2015 3:37 AM, Dejan Lekic wrote:
>> Keep in mind that in D everything is thread-local by default!
>> :)
>> For shared resources use __gshared or shared (although I do
>> not know for
>> sure whether shared works or not).
>
> Note: shared is __gshared but with mutex's added.
Nope. shared is a type modifier that signifies the data is not
guaranteed to be thread-local (and as such can be passed between
threads). It generates no extra code and has no special ordering
or atomicity guarantees.
The way I look at it, shared is roughly equivalent to normal
C/C++ variables.
More information about the Digitalmars-d-learn
mailing list