shared - no read/write access

Kagamin spam at here.lot
Mon Mar 25 08:37:42 UTC 2019


On Thursday, 21 March 2019 at 20:50:09 UTC, Manu wrote:
> But that's now what `shared` does... it allows (guarantees 
> even) many
> threads mutate the same data at random with no protections.
> By inhibiting read/write access, you force the user to obtain a 
> lock
> (or other synchronisation method) in order to access the shared 
> data.
> Without that, the path of least resistance is to just access 
> the data,
> and that's a race 100% of the time, by definition (because it's
> `shared`).

Some memory accesses are thread safe, then synchronization is not 
needed.


More information about the Digitalmars-d mailing list