What classification should shared objects in qeued thread pools have?

mw mingwu at gmail.com
Thu Oct 1 00:23:31 UTC 2020


On Thursday, 1 October 2020 at 00:13:41 UTC, IGotD- wrote:
> I think that the shared in shared structs should not be 
> transitive to members of the struct. The compiler should not

Once the aggregate struct data is decl-ed `shared` as a whole, it 
needs to be transitive to play safe.

The compiler (technology) is not that advanced enough to either 
prove that for a particular sub-component of a shared struct data 
is fine without protection, or the programmer's intention.

> enforce this as we don't really know what the programmer will 
> do inside the struct to ensure the thread safety.

If the programmer is really sure about his/her design, just 
cast() the `shared` away.


More information about the Digitalmars-d-learn mailing list