DIP 1024---Shared Atomics---Final Review

Simen Kjærås simen.kjaras at gmail.com
Tue Dec 10 15:13:36 UTC 2019


On Tuesday, 10 December 2019 at 12:18:39 UTC, RazvanN wrote:
> On Sunday, 8 December 2019 at 16:25:21 UTC, Mike Parker wrote:
>
> If you have a const shared variable, do you still need locks to 
> read it?

You'll need to cast away shared. You can of course do that 
without locks, but you probably shouldn't.

The reason is that, even though const ensures *you* cannot modify 
it, others may, and you risk reading inconsistent data.

--
   Simen


More information about the Digitalmars-d mailing list