Pointer across threads

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 4 06:47:49 PST 2014


On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote:
> I'm still curious, though, how D handles this internally, 
> because data.data is still mutable while the other reference to 
> the same address (tmp) is not. What if I change data.data while 
> the other thread is being executed?

Changing *data.data would be undefined behaviour. Don't do it.
Once data is typed as immutable, it must not change anymore. By
casting you're side-stepping the type system, so that you have to
make sure of such things yourself.


More information about the Digitalmars-d-learn mailing list