"shared" status

Dejan Lekic dejan.lekic at gmail.com
Tue Apr 17 08:30:31 PDT 2012


On Saturday, 14 April 2012 at 10:48:16 UTC, Luis Panadero 
Guardeño wrote:
> What is the status of "shared" types ?
>
> I try it with gdmd v4.6.3
> And I not get any warring/error when I do anything over a 
> shared variable
> without using atomicOp. It's normal ?
>
> shared ushort ram[ram_size];
> ....
> ....
> ram[i] = cast(ushort) (bytes[0] | bytes[1] << 8);

Shared is crucial for concurrency/parallelism since the switch to 
the thread local storage as default storage.

Immutable values are IMPLICITLY SHARED while for your mutable 
data you have to explicitly use "shared" keyword.

This basically means that SHARED data are used everywhere in D 
applications nowadays.


More information about the Digitalmars-d-learn mailing list