shared - i need it to be useful

Simen Kjærås simen.kjaras at gmail.com
Fri Oct 19 20:19:49 UTC 2018


On Friday, 19 October 2018 at 18:00:47 UTC, Atila Neves wrote:
>> Because int or int* does not have threadsafe member functions.
>
> https://dlang.org/phobos/core_atomic.html

Atomic and thread-safe are two very different concepts. 
Thread-safe is more of an ecosystem thing - if there are ways to 
do non-thread-safe operations on something, atomic operations are 
not enough to make things thread-safe. This is what core.atomic 
does:

https://i.imgur.com/PnKMigl.jpg

If you close the other openings, atomics are fantastic building 
blocks to making something thread-safe, but on their own they are 
not enough.

--
   Simen


More information about the Digitalmars-d mailing list