[Issue 17664] Deprecate implicit casting between shared and unshared

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 20 07:56:48 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17664

--- Comment #3 from Steven Schveighoffer <schveiguy at yahoo.com> ---
Making a complete independent copy of a value is not sharing, it's copying.

shared doesn't care about the semantic meaning of your integer. It only cares
if multiple threads have access to the same memory in RAM. That's its only
goal.

Anything above that is on you to provide appropriate protections. In other
words, don't use int handle, use some UnshareableResource struct that protects
the handle internally from accidentally sharing.

--


More information about the Digitalmars-d-bugs mailing list