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

--- Comment #3 from Steven Schveighoffer <[email protected]> ---
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.

--

Reply via email to