Shared - Another Thread
Stefan Koch
uplink.coder at googlemail.com
Wed Oct 17 21:12:49 UTC 2018
Hi,
reading the other shared thread "shared - i need to be
useful"(https://forum.dlang.org/thread/mailman.4299.1539629222.29801.digitalmars-d@puremagic.com)
let me to an important realisation concerning the reason
shareding data across threads is so unintuitve and hard to get
right.
The reason is that sharing in the real world has nothing to do
with using something and the same time.
For example: If I share my flat with another person, that person,
while occupying the same flat as me, cannot actually occupy the
same space. It is physically impossible.
In other words sharing does not mean for multiple entities to own
something it's rather about diving and managing the (temporary)
ownership of fragments.
Therefore if ownership is unclear sharing is impossible.
The safest default for something shared with unclear ownership is
to view it as untouchable/unreadble/unwritable until ownership is
established.
More information about the Digitalmars-d
mailing list